{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "9391fe56",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import scipy.io as sio\n",
    "import numpy as np\n",
    "import math"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "13ed3ef8",
   "metadata": {},
   "source": [
    "# Load DVA dataset"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "361a984a",
   "metadata": {},
   "outputs": [],
   "source": [
    "vi_dr_indi=pd.read_excel('../DVA/data_raw/database.xlsx', sheet_name='Indications(vi-dr)')\n",
    "vi_dr_indi=vi_dr_indi[['VIRUS', 'DRUG']]\n",
    "vi_dr_matrix=vi_dr_indi.groupby(['VIRUS', 'DRUG']).size().unstack().fillna(0) \n",
    "vi_dr_matrix=vi_dr_matrix.sort_index(axis=1)\n",
    "DVA_drug_virus_interaction_df = vi_dr_matrix\n",
    "drug_names = DVA_drug_virus_interaction_df.columns\n",
    "virus_names = DVA_drug_virus_interaction_df.index"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "ea3cf0ba",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Abacavir</th>\n",
       "      <th>Acyclovir</th>\n",
       "      <th>Adefovir</th>\n",
       "      <th>Adefovir dipivoxil</th>\n",
       "      <th>Amantadine</th>\n",
       "      <th>Amprenavir</th>\n",
       "      <th>Asunaprevir</th>\n",
       "      <th>Atazanavir</th>\n",
       "      <th>Baloxavir marboxil</th>\n",
       "      <th>Beclabuvir</th>\n",
       "      <th>...</th>\n",
       "      <th>Valaciclovir</th>\n",
       "      <th>Valganciclovir</th>\n",
       "      <th>Valomaciclovir</th>\n",
       "      <th>Vaniprevir</th>\n",
       "      <th>Velpatasvir</th>\n",
       "      <th>Vidarabine</th>\n",
       "      <th>Voxilaprevir</th>\n",
       "      <th>Zalcitabine</th>\n",
       "      <th>Zanamivir</th>\n",
       "      <th>Zidovudine</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Abacavir</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.501832</td>\n",
       "      <td>0.414474</td>\n",
       "      <td>0.414474</td>\n",
       "      <td>0.156250</td>\n",
       "      <td>0.051724</td>\n",
       "      <td>0.151603</td>\n",
       "      <td>0.053352</td>\n",
       "      <td>0.095238</td>\n",
       "      <td>0.120690</td>\n",
       "      <td>...</td>\n",
       "      <td>0.325967</td>\n",
       "      <td>0.412429</td>\n",
       "      <td>0.287313</td>\n",
       "      <td>0.142061</td>\n",
       "      <td>0.181486</td>\n",
       "      <td>0.525424</td>\n",
       "      <td>0.129235</td>\n",
       "      <td>0.324503</td>\n",
       "      <td>0.195929</td>\n",
       "      <td>0.246459</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Acyclovir</th>\n",
       "      <td>0.443662</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.551724</td>\n",
       "      <td>0.551724</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.018868</td>\n",
       "      <td>0.043478</td>\n",
       "      <td>0.059002</td>\n",
       "      <td>0.127273</td>\n",
       "      <td>0.069277</td>\n",
       "      <td>...</td>\n",
       "      <td>0.694215</td>\n",
       "      <td>0.530249</td>\n",
       "      <td>0.260163</td>\n",
       "      <td>0.027397</td>\n",
       "      <td>0.109741</td>\n",
       "      <td>0.617021</td>\n",
       "      <td>0.062740</td>\n",
       "      <td>0.416309</td>\n",
       "      <td>0.075269</td>\n",
       "      <td>0.302817</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Adefovir</th>\n",
       "      <td>0.414474</td>\n",
       "      <td>0.551724</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.052632</td>\n",
       "      <td>0.057143</td>\n",
       "      <td>0.057269</td>\n",
       "      <td>0.103448</td>\n",
       "      <td>0.079882</td>\n",
       "      <td>...</td>\n",
       "      <td>0.423841</td>\n",
       "      <td>0.315789</td>\n",
       "      <td>0.223709</td>\n",
       "      <td>0.026667</td>\n",
       "      <td>0.116505</td>\n",
       "      <td>0.520913</td>\n",
       "      <td>0.059850</td>\n",
       "      <td>0.236749</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.171171</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Adefovir dipivoxil</th>\n",
       "      <td>0.414474</td>\n",
       "      <td>0.551724</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.052632</td>\n",
       "      <td>0.057143</td>\n",
       "      <td>0.057269</td>\n",
       "      <td>0.103448</td>\n",
       "      <td>0.079882</td>\n",
       "      <td>...</td>\n",
       "      <td>0.423841</td>\n",
       "      <td>0.315789</td>\n",
       "      <td>0.223709</td>\n",
       "      <td>0.026667</td>\n",
       "      <td>0.116505</td>\n",
       "      <td>0.520913</td>\n",
       "      <td>0.059850</td>\n",
       "      <td>0.236749</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.171171</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Amantadine</th>\n",
       "      <td>0.156250</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.061571</td>\n",
       "      <td>0.127695</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.017544</td>\n",
       "      <td>0.116667</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.092308</td>\n",
       "      <td>0.095541</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.091160</td>\n",
       "      <td>0.102662</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.122449</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Vidarabine</th>\n",
       "      <td>0.525424</td>\n",
       "      <td>0.617021</td>\n",
       "      <td>0.520913</td>\n",
       "      <td>0.520913</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.050725</td>\n",
       "      <td>0.055556</td>\n",
       "      <td>0.055635</td>\n",
       "      <td>0.064516</td>\n",
       "      <td>0.112760</td>\n",
       "      <td>...</td>\n",
       "      <td>0.465798</td>\n",
       "      <td>0.525974</td>\n",
       "      <td>0.274131</td>\n",
       "      <td>0.074830</td>\n",
       "      <td>0.100703</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.109694</td>\n",
       "      <td>0.522634</td>\n",
       "      <td>0.122449</td>\n",
       "      <td>0.404110</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Voxilaprevir</th>\n",
       "      <td>0.167315</td>\n",
       "      <td>0.062740</td>\n",
       "      <td>0.059850</td>\n",
       "      <td>0.059850</td>\n",
       "      <td>0.097222</td>\n",
       "      <td>0.185270</td>\n",
       "      <td>0.486486</td>\n",
       "      <td>0.223022</td>\n",
       "      <td>0.180851</td>\n",
       "      <td>0.359003</td>\n",
       "      <td>...</td>\n",
       "      <td>0.057579</td>\n",
       "      <td>0.056257</td>\n",
       "      <td>0.082927</td>\n",
       "      <td>0.551940</td>\n",
       "      <td>0.207646</td>\n",
       "      <td>0.122581</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.106613</td>\n",
       "      <td>0.115288</td>\n",
       "      <td>0.112549</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Zalcitabine</th>\n",
       "      <td>0.324503</td>\n",
       "      <td>0.416309</td>\n",
       "      <td>0.236749</td>\n",
       "      <td>0.236749</td>\n",
       "      <td>0.102662</td>\n",
       "      <td>0.142241</td>\n",
       "      <td>0.092308</td>\n",
       "      <td>0.059908</td>\n",
       "      <td>0.144465</td>\n",
       "      <td>0.127214</td>\n",
       "      <td>...</td>\n",
       "      <td>0.273885</td>\n",
       "      <td>0.324921</td>\n",
       "      <td>0.121324</td>\n",
       "      <td>0.156250</td>\n",
       "      <td>0.096059</td>\n",
       "      <td>0.522634</td>\n",
       "      <td>0.106613</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.130435</td>\n",
       "      <td>0.690141</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Zanamivir</th>\n",
       "      <td>0.291209</td>\n",
       "      <td>0.075269</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.151631</td>\n",
       "      <td>0.125541</td>\n",
       "      <td>0.098266</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.037736</td>\n",
       "      <td>...</td>\n",
       "      <td>0.080460</td>\n",
       "      <td>0.103604</td>\n",
       "      <td>0.114754</td>\n",
       "      <td>0.128134</td>\n",
       "      <td>0.092150</td>\n",
       "      <td>0.122449</td>\n",
       "      <td>0.128010</td>\n",
       "      <td>0.130435</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.143617</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Zidovudine</th>\n",
       "      <td>0.246459</td>\n",
       "      <td>0.302817</td>\n",
       "      <td>0.171171</td>\n",
       "      <td>0.171171</td>\n",
       "      <td>0.122449</td>\n",
       "      <td>0.122047</td>\n",
       "      <td>0.107829</td>\n",
       "      <td>0.067251</td>\n",
       "      <td>0.132404</td>\n",
       "      <td>0.126332</td>\n",
       "      <td>...</td>\n",
       "      <td>0.151832</td>\n",
       "      <td>0.299435</td>\n",
       "      <td>0.169065</td>\n",
       "      <td>0.077348</td>\n",
       "      <td>0.091549</td>\n",
       "      <td>0.404110</td>\n",
       "      <td>0.112549</td>\n",
       "      <td>0.690141</td>\n",
       "      <td>0.143617</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>121 rows × 121 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                    Abacavir  Acyclovir  Adefovir  Adefovir dipivoxil  \\\n",
       "Abacavir            1.000000   0.501832  0.414474            0.414474   \n",
       "Acyclovir           0.443662   1.000000  0.551724            0.551724   \n",
       "Adefovir            0.414474   0.551724  1.000000            1.000000   \n",
       "Adefovir dipivoxil  0.414474   0.551724  1.000000            1.000000   \n",
       "Amantadine          0.156250   0.000000  0.000000            0.000000   \n",
       "...                      ...        ...       ...                 ...   \n",
       "Vidarabine          0.525424   0.617021  0.520913            0.520913   \n",
       "Voxilaprevir        0.167315   0.062740  0.059850            0.059850   \n",
       "Zalcitabine         0.324503   0.416309  0.236749            0.236749   \n",
       "Zanamivir           0.291209   0.075269  0.000000            0.000000   \n",
       "Zidovudine          0.246459   0.302817  0.171171            0.171171   \n",
       "\n",
       "                    Amantadine  Amprenavir  Asunaprevir  Atazanavir  \\\n",
       "Abacavir              0.156250    0.051724     0.151603    0.053352   \n",
       "Acyclovir             0.000000    0.018868     0.043478    0.059002   \n",
       "Adefovir              0.000000    0.052632     0.057143    0.057269   \n",
       "Adefovir dipivoxil    0.000000    0.052632     0.057143    0.057269   \n",
       "Amantadine            1.000000    0.061571     0.127695    0.000000   \n",
       "...                        ...         ...          ...         ...   \n",
       "Vidarabine            0.000000    0.050725     0.055556    0.055635   \n",
       "Voxilaprevir          0.097222    0.185270     0.486486    0.223022   \n",
       "Zalcitabine           0.102662    0.142241     0.092308    0.059908   \n",
       "Zanamivir             0.000000    0.151631     0.125541    0.098266   \n",
       "Zidovudine            0.122449    0.122047     0.107829    0.067251   \n",
       "\n",
       "                    Baloxavir marboxil  Beclabuvir  ...  Valaciclovir  \\\n",
       "Abacavir                      0.095238    0.120690  ...      0.325967   \n",
       "Acyclovir                     0.127273    0.069277  ...      0.694215   \n",
       "Adefovir                      0.103448    0.079882  ...      0.423841   \n",
       "Adefovir dipivoxil            0.103448    0.079882  ...      0.423841   \n",
       "Amantadine                    0.017544    0.116667  ...      0.000000   \n",
       "...                                ...         ...  ...           ...   \n",
       "Vidarabine                    0.064516    0.112760  ...      0.465798   \n",
       "Voxilaprevir                  0.180851    0.359003  ...      0.057579   \n",
       "Zalcitabine                   0.144465    0.127214  ...      0.273885   \n",
       "Zanamivir                     0.000000    0.037736  ...      0.080460   \n",
       "Zidovudine                    0.132404    0.126332  ...      0.151832   \n",
       "\n",
       "                    Valganciclovir  Valomaciclovir  Vaniprevir  Velpatasvir  \\\n",
       "Abacavir                  0.412429        0.287313    0.142061     0.181486   \n",
       "Acyclovir                 0.530249        0.260163    0.027397     0.109741   \n",
       "Adefovir                  0.315789        0.223709    0.026667     0.116505   \n",
       "Adefovir dipivoxil        0.315789        0.223709    0.026667     0.116505   \n",
       "Amantadine                0.000000        0.000000    0.092308     0.095541   \n",
       "...                            ...             ...         ...          ...   \n",
       "Vidarabine                0.525974        0.274131    0.074830     0.100703   \n",
       "Voxilaprevir              0.056257        0.082927    0.551940     0.207646   \n",
       "Zalcitabine               0.324921        0.121324    0.156250     0.096059   \n",
       "Zanamivir                 0.103604        0.114754    0.128134     0.092150   \n",
       "Zidovudine                0.299435        0.169065    0.077348     0.091549   \n",
       "\n",
       "                    Vidarabine  Voxilaprevir  Zalcitabine  Zanamivir  \\\n",
       "Abacavir              0.525424      0.129235     0.324503   0.195929   \n",
       "Acyclovir             0.617021      0.062740     0.416309   0.075269   \n",
       "Adefovir              0.520913      0.059850     0.236749   0.000000   \n",
       "Adefovir dipivoxil    0.520913      0.059850     0.236749   0.000000   \n",
       "Amantadine            0.000000      0.091160     0.102662   0.000000   \n",
       "...                        ...           ...          ...        ...   \n",
       "Vidarabine            1.000000      0.109694     0.522634   0.122449   \n",
       "Voxilaprevir          0.122581      1.000000     0.106613   0.115288   \n",
       "Zalcitabine           0.522634      0.106613     1.000000   0.130435   \n",
       "Zanamivir             0.122449      0.128010     0.130435   1.000000   \n",
       "Zidovudine            0.404110      0.112549     0.690141   0.143617   \n",
       "\n",
       "                    Zidovudine  \n",
       "Abacavir              0.246459  \n",
       "Acyclovir             0.302817  \n",
       "Adefovir              0.171171  \n",
       "Adefovir dipivoxil    0.171171  \n",
       "Amantadine            0.122449  \n",
       "...                        ...  \n",
       "Vidarabine            0.404110  \n",
       "Voxilaprevir          0.112549  \n",
       "Zalcitabine           0.690141  \n",
       "Zanamivir             0.143617  \n",
       "Zidovudine            1.000000  \n",
       "\n",
       "[121 rows x 121 columns]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "DVA_drug_drug_sim_df = pd.read_csv('../DVA/data_processed/similarity_drugs.csv')\n",
    "DVA_drug_drug_sim_df.index = DVA_drug_drug_sim_df['DRUG2'].values\n",
    "DVA_drug_drug_sim_df = DVA_drug_drug_sim_df.drop(columns=['DRUG2'], axis = 1)\n",
    "DVA_drug_drug_sim_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "5e1774a2",
   "metadata": {},
   "outputs": [],
   "source": [
    "sio.savemat('drug_sim_matrix1.mat',{'Sd':DVA_drug_drug_sim_df.values , 'dr_names':DVA_drug_drug_sim_df.index.values})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "53f1ed47",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Chikungunya virus</th>\n",
       "      <th>Coxsackievirus B5</th>\n",
       "      <th>Ebola virus</th>\n",
       "      <th>Enterovirus D</th>\n",
       "      <th>Enterovirus J</th>\n",
       "      <th>HBV</th>\n",
       "      <th>HCV</th>\n",
       "      <th>HHV-1</th>\n",
       "      <th>HHV-2</th>\n",
       "      <th>HHV-3</th>\n",
       "      <th>...</th>\n",
       "      <th>Nipah virus</th>\n",
       "      <th>RSV</th>\n",
       "      <th>SARS-CoV</th>\n",
       "      <th>SARS-CoV-2</th>\n",
       "      <th>SARS-CoV-2/BHR</th>\n",
       "      <th>SARS-CoV-2/IND2</th>\n",
       "      <th>SARS-CoV-2/USA/AL</th>\n",
       "      <th>VV</th>\n",
       "      <th>Variola virus</th>\n",
       "      <th>Zika virus</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>d2star</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Chikungunya virus</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.516603</td>\n",
       "      <td>0.532395</td>\n",
       "      <td>0.519898</td>\n",
       "      <td>0.508609</td>\n",
       "      <td>0.521714</td>\n",
       "      <td>0.539485</td>\n",
       "      <td>0.579950</td>\n",
       "      <td>0.575516</td>\n",
       "      <td>0.548850</td>\n",
       "      <td>...</td>\n",
       "      <td>0.530703</td>\n",
       "      <td>0.523285</td>\n",
       "      <td>0.555768</td>\n",
       "      <td>0.570482</td>\n",
       "      <td>0.571042</td>\n",
       "      <td>0.569493</td>\n",
       "      <td>0.569774</td>\n",
       "      <td>0.582249</td>\n",
       "      <td>0.594740</td>\n",
       "      <td>0.541225</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Coxsackievirus B5</th>\n",
       "      <td>0.516603</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.513568</td>\n",
       "      <td>0.570859</td>\n",
       "      <td>0.557930</td>\n",
       "      <td>0.516581</td>\n",
       "      <td>0.488933</td>\n",
       "      <td>0.542364</td>\n",
       "      <td>0.527871</td>\n",
       "      <td>0.500370</td>\n",
       "      <td>...</td>\n",
       "      <td>0.541211</td>\n",
       "      <td>0.523202</td>\n",
       "      <td>0.540989</td>\n",
       "      <td>0.553558</td>\n",
       "      <td>0.553633</td>\n",
       "      <td>0.553917</td>\n",
       "      <td>0.554496</td>\n",
       "      <td>0.510400</td>\n",
       "      <td>0.525899</td>\n",
       "      <td>0.501666</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Ebola virus</th>\n",
       "      <td>0.532395</td>\n",
       "      <td>0.513568</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.503441</td>\n",
       "      <td>0.498397</td>\n",
       "      <td>0.509264</td>\n",
       "      <td>0.535986</td>\n",
       "      <td>0.536519</td>\n",
       "      <td>0.551883</td>\n",
       "      <td>0.529696</td>\n",
       "      <td>...</td>\n",
       "      <td>0.539395</td>\n",
       "      <td>0.520057</td>\n",
       "      <td>0.557383</td>\n",
       "      <td>0.559995</td>\n",
       "      <td>0.560754</td>\n",
       "      <td>0.560548</td>\n",
       "      <td>0.559151</td>\n",
       "      <td>0.542935</td>\n",
       "      <td>0.548989</td>\n",
       "      <td>0.520352</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Enterovirus D</th>\n",
       "      <td>0.519898</td>\n",
       "      <td>0.570859</td>\n",
       "      <td>0.503441</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.559862</td>\n",
       "      <td>0.522836</td>\n",
       "      <td>0.474324</td>\n",
       "      <td>0.530538</td>\n",
       "      <td>0.520856</td>\n",
       "      <td>0.524424</td>\n",
       "      <td>...</td>\n",
       "      <td>0.513799</td>\n",
       "      <td>0.503035</td>\n",
       "      <td>0.539165</td>\n",
       "      <td>0.538074</td>\n",
       "      <td>0.537502</td>\n",
       "      <td>0.538426</td>\n",
       "      <td>0.537993</td>\n",
       "      <td>0.538473</td>\n",
       "      <td>0.539484</td>\n",
       "      <td>0.488926</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Enterovirus J</th>\n",
       "      <td>0.508609</td>\n",
       "      <td>0.557930</td>\n",
       "      <td>0.498397</td>\n",
       "      <td>0.559862</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.506899</td>\n",
       "      <td>0.484325</td>\n",
       "      <td>0.502548</td>\n",
       "      <td>0.504797</td>\n",
       "      <td>0.499448</td>\n",
       "      <td>...</td>\n",
       "      <td>0.522267</td>\n",
       "      <td>0.527416</td>\n",
       "      <td>0.548926</td>\n",
       "      <td>0.533067</td>\n",
       "      <td>0.533419</td>\n",
       "      <td>0.532940</td>\n",
       "      <td>0.533549</td>\n",
       "      <td>0.505114</td>\n",
       "      <td>0.510359</td>\n",
       "      <td>0.502136</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>HBV</th>\n",
       "      <td>0.521714</td>\n",
       "      <td>0.516581</td>\n",
       "      <td>0.509264</td>\n",
       "      <td>0.522836</td>\n",
       "      <td>0.506899</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.509182</td>\n",
       "      <td>0.538787</td>\n",
       "      <td>0.544751</td>\n",
       "      <td>0.520635</td>\n",
       "      <td>...</td>\n",
       "      <td>0.527798</td>\n",
       "      <td>0.513848</td>\n",
       "      <td>0.522710</td>\n",
       "      <td>0.525323</td>\n",
       "      <td>0.524589</td>\n",
       "      <td>0.526115</td>\n",
       "      <td>0.524838</td>\n",
       "      <td>0.534670</td>\n",
       "      <td>0.537287</td>\n",
       "      <td>0.526243</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>HCV</th>\n",
       "      <td>0.539485</td>\n",
       "      <td>0.488933</td>\n",
       "      <td>0.535986</td>\n",
       "      <td>0.474324</td>\n",
       "      <td>0.484325</td>\n",
       "      <td>0.509182</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.601197</td>\n",
       "      <td>0.610380</td>\n",
       "      <td>0.565284</td>\n",
       "      <td>...</td>\n",
       "      <td>0.529315</td>\n",
       "      <td>0.525334</td>\n",
       "      <td>0.533091</td>\n",
       "      <td>0.533642</td>\n",
       "      <td>0.533877</td>\n",
       "      <td>0.532928</td>\n",
       "      <td>0.534290</td>\n",
       "      <td>0.555293</td>\n",
       "      <td>0.552597</td>\n",
       "      <td>0.537866</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>HHV-1</th>\n",
       "      <td>0.579950</td>\n",
       "      <td>0.542364</td>\n",
       "      <td>0.536519</td>\n",
       "      <td>0.530538</td>\n",
       "      <td>0.502548</td>\n",
       "      <td>0.538787</td>\n",
       "      <td>0.601197</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.923709</td>\n",
       "      <td>0.664674</td>\n",
       "      <td>...</td>\n",
       "      <td>0.561140</td>\n",
       "      <td>0.533397</td>\n",
       "      <td>0.590993</td>\n",
       "      <td>0.583255</td>\n",
       "      <td>0.582502</td>\n",
       "      <td>0.583773</td>\n",
       "      <td>0.582919</td>\n",
       "      <td>0.620861</td>\n",
       "      <td>0.630542</td>\n",
       "      <td>0.546510</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>HHV-2</th>\n",
       "      <td>0.575516</td>\n",
       "      <td>0.527871</td>\n",
       "      <td>0.551883</td>\n",
       "      <td>0.520856</td>\n",
       "      <td>0.504797</td>\n",
       "      <td>0.544751</td>\n",
       "      <td>0.610380</td>\n",
       "      <td>0.923709</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.654162</td>\n",
       "      <td>...</td>\n",
       "      <td>0.562328</td>\n",
       "      <td>0.533808</td>\n",
       "      <td>0.588871</td>\n",
       "      <td>0.585227</td>\n",
       "      <td>0.585647</td>\n",
       "      <td>0.584823</td>\n",
       "      <td>0.585937</td>\n",
       "      <td>0.621845</td>\n",
       "      <td>0.632663</td>\n",
       "      <td>0.555958</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>HHV-3</th>\n",
       "      <td>0.548850</td>\n",
       "      <td>0.500370</td>\n",
       "      <td>0.529696</td>\n",
       "      <td>0.524424</td>\n",
       "      <td>0.499448</td>\n",
       "      <td>0.520635</td>\n",
       "      <td>0.565284</td>\n",
       "      <td>0.664674</td>\n",
       "      <td>0.654162</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.514074</td>\n",
       "      <td>0.555458</td>\n",
       "      <td>0.519492</td>\n",
       "      <td>0.560829</td>\n",
       "      <td>0.560458</td>\n",
       "      <td>0.559830</td>\n",
       "      <td>0.560307</td>\n",
       "      <td>0.605856</td>\n",
       "      <td>0.625449</td>\n",
       "      <td>0.538801</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>HHV-4</th>\n",
       "      <td>0.556191</td>\n",
       "      <td>0.521696</td>\n",
       "      <td>0.528878</td>\n",
       "      <td>0.528164</td>\n",
       "      <td>0.544281</td>\n",
       "      <td>0.518547</td>\n",
       "      <td>0.562101</td>\n",
       "      <td>0.751015</td>\n",
       "      <td>0.763389</td>\n",
       "      <td>0.639311</td>\n",
       "      <td>...</td>\n",
       "      <td>0.536755</td>\n",
       "      <td>0.537795</td>\n",
       "      <td>0.581425</td>\n",
       "      <td>0.582750</td>\n",
       "      <td>0.583601</td>\n",
       "      <td>0.583483</td>\n",
       "      <td>0.582473</td>\n",
       "      <td>0.608974</td>\n",
       "      <td>0.624289</td>\n",
       "      <td>0.535054</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>HHV-5</th>\n",
       "      <td>0.603756</td>\n",
       "      <td>0.536704</td>\n",
       "      <td>0.573636</td>\n",
       "      <td>0.522022</td>\n",
       "      <td>0.512548</td>\n",
       "      <td>0.552126</td>\n",
       "      <td>0.622329</td>\n",
       "      <td>0.805508</td>\n",
       "      <td>0.832868</td>\n",
       "      <td>0.634040</td>\n",
       "      <td>...</td>\n",
       "      <td>0.576293</td>\n",
       "      <td>0.542026</td>\n",
       "      <td>0.610185</td>\n",
       "      <td>0.604332</td>\n",
       "      <td>0.605006</td>\n",
       "      <td>0.603799</td>\n",
       "      <td>0.605022</td>\n",
       "      <td>0.669318</td>\n",
       "      <td>0.686044</td>\n",
       "      <td>0.576288</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>HHV-6B</th>\n",
       "      <td>0.545105</td>\n",
       "      <td>0.497999</td>\n",
       "      <td>0.537894</td>\n",
       "      <td>0.498315</td>\n",
       "      <td>0.496539</td>\n",
       "      <td>0.524471</td>\n",
       "      <td>0.568921</td>\n",
       "      <td>0.628677</td>\n",
       "      <td>0.629655</td>\n",
       "      <td>0.634080</td>\n",
       "      <td>...</td>\n",
       "      <td>0.511283</td>\n",
       "      <td>0.530657</td>\n",
       "      <td>0.544347</td>\n",
       "      <td>0.532837</td>\n",
       "      <td>0.532238</td>\n",
       "      <td>0.533615</td>\n",
       "      <td>0.533158</td>\n",
       "      <td>0.587750</td>\n",
       "      <td>0.600244</td>\n",
       "      <td>0.551489</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>HHV-8</th>\n",
       "      <td>0.585898</td>\n",
       "      <td>0.544797</td>\n",
       "      <td>0.546030</td>\n",
       "      <td>0.536158</td>\n",
       "      <td>0.531798</td>\n",
       "      <td>0.528193</td>\n",
       "      <td>0.583633</td>\n",
       "      <td>0.743176</td>\n",
       "      <td>0.744011</td>\n",
       "      <td>0.650543</td>\n",
       "      <td>...</td>\n",
       "      <td>0.536298</td>\n",
       "      <td>0.533905</td>\n",
       "      <td>0.576323</td>\n",
       "      <td>0.560440</td>\n",
       "      <td>0.560679</td>\n",
       "      <td>0.561032</td>\n",
       "      <td>0.560840</td>\n",
       "      <td>0.634755</td>\n",
       "      <td>0.663804</td>\n",
       "      <td>0.562551</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>HIV-1</th>\n",
       "      <td>0.527765</td>\n",
       "      <td>0.490831</td>\n",
       "      <td>0.535352</td>\n",
       "      <td>0.525733</td>\n",
       "      <td>0.517266</td>\n",
       "      <td>0.502090</td>\n",
       "      <td>0.521066</td>\n",
       "      <td>0.547129</td>\n",
       "      <td>0.564710</td>\n",
       "      <td>0.522266</td>\n",
       "      <td>...</td>\n",
       "      <td>0.518055</td>\n",
       "      <td>0.516068</td>\n",
       "      <td>0.564588</td>\n",
       "      <td>0.545504</td>\n",
       "      <td>0.545667</td>\n",
       "      <td>0.545093</td>\n",
       "      <td>0.545330</td>\n",
       "      <td>0.563069</td>\n",
       "      <td>0.576860</td>\n",
       "      <td>0.537206</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>HIV-2</th>\n",
       "      <td>0.550270</td>\n",
       "      <td>0.506106</td>\n",
       "      <td>0.526720</td>\n",
       "      <td>0.508127</td>\n",
       "      <td>0.518558</td>\n",
       "      <td>0.526467</td>\n",
       "      <td>0.518988</td>\n",
       "      <td>0.549193</td>\n",
       "      <td>0.568534</td>\n",
       "      <td>0.562429</td>\n",
       "      <td>...</td>\n",
       "      <td>0.515225</td>\n",
       "      <td>0.515360</td>\n",
       "      <td>0.545250</td>\n",
       "      <td>0.549069</td>\n",
       "      <td>0.548837</td>\n",
       "      <td>0.549236</td>\n",
       "      <td>0.549529</td>\n",
       "      <td>0.558640</td>\n",
       "      <td>0.568388</td>\n",
       "      <td>0.519396</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>HPIV-2</th>\n",
       "      <td>0.500118</td>\n",
       "      <td>0.505537</td>\n",
       "      <td>0.558169</td>\n",
       "      <td>0.497506</td>\n",
       "      <td>0.495492</td>\n",
       "      <td>0.506574</td>\n",
       "      <td>0.525639</td>\n",
       "      <td>0.547037</td>\n",
       "      <td>0.567750</td>\n",
       "      <td>0.532054</td>\n",
       "      <td>...</td>\n",
       "      <td>0.570627</td>\n",
       "      <td>0.546678</td>\n",
       "      <td>0.542142</td>\n",
       "      <td>0.549142</td>\n",
       "      <td>0.548397</td>\n",
       "      <td>0.548633</td>\n",
       "      <td>0.549739</td>\n",
       "      <td>0.547799</td>\n",
       "      <td>0.560852</td>\n",
       "      <td>0.527757</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>HPIV-3</th>\n",
       "      <td>0.530805</td>\n",
       "      <td>0.510299</td>\n",
       "      <td>0.525593</td>\n",
       "      <td>0.524923</td>\n",
       "      <td>0.519557</td>\n",
       "      <td>0.497884</td>\n",
       "      <td>0.505323</td>\n",
       "      <td>0.549225</td>\n",
       "      <td>0.557101</td>\n",
       "      <td>0.529184</td>\n",
       "      <td>...</td>\n",
       "      <td>0.557822</td>\n",
       "      <td>0.529475</td>\n",
       "      <td>0.541224</td>\n",
       "      <td>0.558373</td>\n",
       "      <td>0.557612</td>\n",
       "      <td>0.558473</td>\n",
       "      <td>0.558124</td>\n",
       "      <td>0.529867</td>\n",
       "      <td>0.544899</td>\n",
       "      <td>0.526766</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>HPV</th>\n",
       "      <td>0.511945</td>\n",
       "      <td>0.501181</td>\n",
       "      <td>0.529703</td>\n",
       "      <td>0.497422</td>\n",
       "      <td>0.503524</td>\n",
       "      <td>0.528207</td>\n",
       "      <td>0.523119</td>\n",
       "      <td>0.539370</td>\n",
       "      <td>0.554519</td>\n",
       "      <td>0.588628</td>\n",
       "      <td>...</td>\n",
       "      <td>0.519142</td>\n",
       "      <td>0.498829</td>\n",
       "      <td>0.524642</td>\n",
       "      <td>0.546315</td>\n",
       "      <td>0.547265</td>\n",
       "      <td>0.545504</td>\n",
       "      <td>0.546802</td>\n",
       "      <td>0.541400</td>\n",
       "      <td>0.575034</td>\n",
       "      <td>0.510152</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>HRV-A</th>\n",
       "      <td>0.521557</td>\n",
       "      <td>0.557734</td>\n",
       "      <td>0.528037</td>\n",
       "      <td>0.546739</td>\n",
       "      <td>0.562568</td>\n",
       "      <td>0.497736</td>\n",
       "      <td>0.502146</td>\n",
       "      <td>0.557879</td>\n",
       "      <td>0.558792</td>\n",
       "      <td>0.524480</td>\n",
       "      <td>...</td>\n",
       "      <td>0.536252</td>\n",
       "      <td>0.499902</td>\n",
       "      <td>0.546831</td>\n",
       "      <td>0.559648</td>\n",
       "      <td>0.559558</td>\n",
       "      <td>0.558662</td>\n",
       "      <td>0.559220</td>\n",
       "      <td>0.527702</td>\n",
       "      <td>0.537124</td>\n",
       "      <td>0.503093</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>HRV-B</th>\n",
       "      <td>0.499875</td>\n",
       "      <td>0.535269</td>\n",
       "      <td>0.514640</td>\n",
       "      <td>0.563810</td>\n",
       "      <td>0.564548</td>\n",
       "      <td>0.507214</td>\n",
       "      <td>0.492007</td>\n",
       "      <td>0.555949</td>\n",
       "      <td>0.546299</td>\n",
       "      <td>0.536300</td>\n",
       "      <td>...</td>\n",
       "      <td>0.504971</td>\n",
       "      <td>0.498305</td>\n",
       "      <td>0.520603</td>\n",
       "      <td>0.518662</td>\n",
       "      <td>0.519367</td>\n",
       "      <td>0.518346</td>\n",
       "      <td>0.518129</td>\n",
       "      <td>0.536627</td>\n",
       "      <td>0.535328</td>\n",
       "      <td>0.503093</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>HTLV-1</th>\n",
       "      <td>0.501660</td>\n",
       "      <td>0.493729</td>\n",
       "      <td>0.529036</td>\n",
       "      <td>0.507097</td>\n",
       "      <td>0.509284</td>\n",
       "      <td>0.507088</td>\n",
       "      <td>0.509075</td>\n",
       "      <td>0.548994</td>\n",
       "      <td>0.562491</td>\n",
       "      <td>0.538997</td>\n",
       "      <td>...</td>\n",
       "      <td>0.531234</td>\n",
       "      <td>0.512965</td>\n",
       "      <td>0.520243</td>\n",
       "      <td>0.509667</td>\n",
       "      <td>0.509969</td>\n",
       "      <td>0.509796</td>\n",
       "      <td>0.509268</td>\n",
       "      <td>0.534313</td>\n",
       "      <td>0.543082</td>\n",
       "      <td>0.520954</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Hantaan orthohantavirus</th>\n",
       "      <td>0.521041</td>\n",
       "      <td>0.522319</td>\n",
       "      <td>0.534352</td>\n",
       "      <td>0.508605</td>\n",
       "      <td>0.495211</td>\n",
       "      <td>0.525732</td>\n",
       "      <td>0.511932</td>\n",
       "      <td>0.520780</td>\n",
       "      <td>0.507603</td>\n",
       "      <td>0.478137</td>\n",
       "      <td>...</td>\n",
       "      <td>0.511735</td>\n",
       "      <td>0.500426</td>\n",
       "      <td>0.515701</td>\n",
       "      <td>0.520731</td>\n",
       "      <td>0.520616</td>\n",
       "      <td>0.520726</td>\n",
       "      <td>0.520610</td>\n",
       "      <td>0.518196</td>\n",
       "      <td>0.512523</td>\n",
       "      <td>0.523055</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Hendra virus</th>\n",
       "      <td>0.535607</td>\n",
       "      <td>0.523883</td>\n",
       "      <td>0.553989</td>\n",
       "      <td>0.524192</td>\n",
       "      <td>0.529963</td>\n",
       "      <td>0.525165</td>\n",
       "      <td>0.542898</td>\n",
       "      <td>0.560089</td>\n",
       "      <td>0.567557</td>\n",
       "      <td>0.521381</td>\n",
       "      <td>...</td>\n",
       "      <td>0.614084</td>\n",
       "      <td>0.549513</td>\n",
       "      <td>0.570181</td>\n",
       "      <td>0.558101</td>\n",
       "      <td>0.557423</td>\n",
       "      <td>0.558382</td>\n",
       "      <td>0.557408</td>\n",
       "      <td>0.551098</td>\n",
       "      <td>0.556279</td>\n",
       "      <td>0.522019</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Human adenovirus</th>\n",
       "      <td>0.569519</td>\n",
       "      <td>0.498210</td>\n",
       "      <td>0.546800</td>\n",
       "      <td>0.522306</td>\n",
       "      <td>0.491636</td>\n",
       "      <td>0.526842</td>\n",
       "      <td>0.606443</td>\n",
       "      <td>0.722914</td>\n",
       "      <td>0.745194</td>\n",
       "      <td>0.630264</td>\n",
       "      <td>...</td>\n",
       "      <td>0.539682</td>\n",
       "      <td>0.532778</td>\n",
       "      <td>0.569111</td>\n",
       "      <td>0.558859</td>\n",
       "      <td>0.559464</td>\n",
       "      <td>0.558693</td>\n",
       "      <td>0.558086</td>\n",
       "      <td>0.606433</td>\n",
       "      <td>0.634814</td>\n",
       "      <td>0.539465</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Human polyomavirus</th>\n",
       "      <td>0.525485</td>\n",
       "      <td>0.515644</td>\n",
       "      <td>0.537408</td>\n",
       "      <td>0.511688</td>\n",
       "      <td>0.485437</td>\n",
       "      <td>0.536040</td>\n",
       "      <td>0.522992</td>\n",
       "      <td>0.556156</td>\n",
       "      <td>0.565274</td>\n",
       "      <td>0.560539</td>\n",
       "      <td>...</td>\n",
       "      <td>0.533111</td>\n",
       "      <td>0.501263</td>\n",
       "      <td>0.525851</td>\n",
       "      <td>0.544628</td>\n",
       "      <td>0.544768</td>\n",
       "      <td>0.545438</td>\n",
       "      <td>0.544376</td>\n",
       "      <td>0.552531</td>\n",
       "      <td>0.553858</td>\n",
       "      <td>0.534483</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Influenza A virus</th>\n",
       "      <td>0.505682</td>\n",
       "      <td>0.512410</td>\n",
       "      <td>0.502796</td>\n",
       "      <td>0.521183</td>\n",
       "      <td>0.515899</td>\n",
       "      <td>0.505161</td>\n",
       "      <td>0.492594</td>\n",
       "      <td>0.503788</td>\n",
       "      <td>0.514423</td>\n",
       "      <td>0.503637</td>\n",
       "      <td>...</td>\n",
       "      <td>0.526910</td>\n",
       "      <td>0.506141</td>\n",
       "      <td>0.524090</td>\n",
       "      <td>0.500943</td>\n",
       "      <td>0.500665</td>\n",
       "      <td>0.500551</td>\n",
       "      <td>0.501633</td>\n",
       "      <td>0.510801</td>\n",
       "      <td>0.532387</td>\n",
       "      <td>0.522643</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Influenza B virus</th>\n",
       "      <td>0.507271</td>\n",
       "      <td>0.514054</td>\n",
       "      <td>0.535551</td>\n",
       "      <td>0.522278</td>\n",
       "      <td>0.533802</td>\n",
       "      <td>0.509814</td>\n",
       "      <td>0.491391</td>\n",
       "      <td>0.520589</td>\n",
       "      <td>0.526030</td>\n",
       "      <td>0.511440</td>\n",
       "      <td>...</td>\n",
       "      <td>0.534239</td>\n",
       "      <td>0.515936</td>\n",
       "      <td>0.579757</td>\n",
       "      <td>0.563785</td>\n",
       "      <td>0.563242</td>\n",
       "      <td>0.564155</td>\n",
       "      <td>0.563298</td>\n",
       "      <td>0.571046</td>\n",
       "      <td>0.591862</td>\n",
       "      <td>0.526752</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Influenza C virus</th>\n",
       "      <td>0.533277</td>\n",
       "      <td>0.495948</td>\n",
       "      <td>0.533297</td>\n",
       "      <td>0.537011</td>\n",
       "      <td>0.541125</td>\n",
       "      <td>0.521881</td>\n",
       "      <td>0.503351</td>\n",
       "      <td>0.538163</td>\n",
       "      <td>0.540882</td>\n",
       "      <td>0.551409</td>\n",
       "      <td>...</td>\n",
       "      <td>0.538158</td>\n",
       "      <td>0.496256</td>\n",
       "      <td>0.543968</td>\n",
       "      <td>0.533582</td>\n",
       "      <td>0.533990</td>\n",
       "      <td>0.534230</td>\n",
       "      <td>0.532767</td>\n",
       "      <td>0.554829</td>\n",
       "      <td>0.571070</td>\n",
       "      <td>0.514296</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Lassa mammarenavirus</th>\n",
       "      <td>0.512534</td>\n",
       "      <td>0.517264</td>\n",
       "      <td>0.535780</td>\n",
       "      <td>0.512673</td>\n",
       "      <td>0.513018</td>\n",
       "      <td>0.505781</td>\n",
       "      <td>0.503310</td>\n",
       "      <td>0.507440</td>\n",
       "      <td>0.521164</td>\n",
       "      <td>0.504545</td>\n",
       "      <td>...</td>\n",
       "      <td>0.530432</td>\n",
       "      <td>0.509559</td>\n",
       "      <td>0.527542</td>\n",
       "      <td>0.549456</td>\n",
       "      <td>0.549439</td>\n",
       "      <td>0.548870</td>\n",
       "      <td>0.548885</td>\n",
       "      <td>0.549818</td>\n",
       "      <td>0.555074</td>\n",
       "      <td>0.520639</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>MCV</th>\n",
       "      <td>0.555728</td>\n",
       "      <td>0.519451</td>\n",
       "      <td>0.553710</td>\n",
       "      <td>0.493761</td>\n",
       "      <td>0.534010</td>\n",
       "      <td>0.540400</td>\n",
       "      <td>0.626379</td>\n",
       "      <td>0.714524</td>\n",
       "      <td>0.759096</td>\n",
       "      <td>0.552874</td>\n",
       "      <td>...</td>\n",
       "      <td>0.538342</td>\n",
       "      <td>0.506792</td>\n",
       "      <td>0.577606</td>\n",
       "      <td>0.550753</td>\n",
       "      <td>0.550825</td>\n",
       "      <td>0.550480</td>\n",
       "      <td>0.550728</td>\n",
       "      <td>0.551336</td>\n",
       "      <td>0.560594</td>\n",
       "      <td>0.544827</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>MERS-CoV</th>\n",
       "      <td>0.544573</td>\n",
       "      <td>0.529717</td>\n",
       "      <td>0.531314</td>\n",
       "      <td>0.520923</td>\n",
       "      <td>0.542819</td>\n",
       "      <td>0.518922</td>\n",
       "      <td>0.510463</td>\n",
       "      <td>0.571731</td>\n",
       "      <td>0.569016</td>\n",
       "      <td>0.540457</td>\n",
       "      <td>...</td>\n",
       "      <td>0.540172</td>\n",
       "      <td>0.545235</td>\n",
       "      <td>0.643252</td>\n",
       "      <td>0.644644</td>\n",
       "      <td>0.645560</td>\n",
       "      <td>0.644940</td>\n",
       "      <td>0.645169</td>\n",
       "      <td>0.586605</td>\n",
       "      <td>0.600338</td>\n",
       "      <td>0.556616</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Nipah virus</th>\n",
       "      <td>0.530703</td>\n",
       "      <td>0.541211</td>\n",
       "      <td>0.539395</td>\n",
       "      <td>0.513799</td>\n",
       "      <td>0.522267</td>\n",
       "      <td>0.527798</td>\n",
       "      <td>0.529315</td>\n",
       "      <td>0.561140</td>\n",
       "      <td>0.562328</td>\n",
       "      <td>0.514074</td>\n",
       "      <td>...</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.547071</td>\n",
       "      <td>0.573436</td>\n",
       "      <td>0.566552</td>\n",
       "      <td>0.566022</td>\n",
       "      <td>0.566721</td>\n",
       "      <td>0.565553</td>\n",
       "      <td>0.558850</td>\n",
       "      <td>0.573780</td>\n",
       "      <td>0.532405</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>RSV</th>\n",
       "      <td>0.523285</td>\n",
       "      <td>0.523202</td>\n",
       "      <td>0.520057</td>\n",
       "      <td>0.503035</td>\n",
       "      <td>0.527416</td>\n",
       "      <td>0.513848</td>\n",
       "      <td>0.525334</td>\n",
       "      <td>0.533397</td>\n",
       "      <td>0.533808</td>\n",
       "      <td>0.555458</td>\n",
       "      <td>...</td>\n",
       "      <td>0.547071</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.544726</td>\n",
       "      <td>0.546554</td>\n",
       "      <td>0.545701</td>\n",
       "      <td>0.546263</td>\n",
       "      <td>0.545905</td>\n",
       "      <td>0.531494</td>\n",
       "      <td>0.549620</td>\n",
       "      <td>0.518027</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>SARS-CoV</th>\n",
       "      <td>0.555768</td>\n",
       "      <td>0.540989</td>\n",
       "      <td>0.557383</td>\n",
       "      <td>0.539165</td>\n",
       "      <td>0.548926</td>\n",
       "      <td>0.522710</td>\n",
       "      <td>0.533091</td>\n",
       "      <td>0.590993</td>\n",
       "      <td>0.588871</td>\n",
       "      <td>0.519492</td>\n",
       "      <td>...</td>\n",
       "      <td>0.573436</td>\n",
       "      <td>0.544726</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.728346</td>\n",
       "      <td>0.727293</td>\n",
       "      <td>0.726386</td>\n",
       "      <td>0.727472</td>\n",
       "      <td>0.600216</td>\n",
       "      <td>0.626422</td>\n",
       "      <td>0.558093</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>SARS-CoV-2</th>\n",
       "      <td>0.570482</td>\n",
       "      <td>0.553558</td>\n",
       "      <td>0.559995</td>\n",
       "      <td>0.538074</td>\n",
       "      <td>0.533067</td>\n",
       "      <td>0.525323</td>\n",
       "      <td>0.533642</td>\n",
       "      <td>0.583255</td>\n",
       "      <td>0.585227</td>\n",
       "      <td>0.560829</td>\n",
       "      <td>...</td>\n",
       "      <td>0.566552</td>\n",
       "      <td>0.546554</td>\n",
       "      <td>0.728346</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.998103</td>\n",
       "      <td>0.999031</td>\n",
       "      <td>0.997713</td>\n",
       "      <td>0.581480</td>\n",
       "      <td>0.603974</td>\n",
       "      <td>0.556155</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>SARS-CoV-2/BHR</th>\n",
       "      <td>0.571042</td>\n",
       "      <td>0.553633</td>\n",
       "      <td>0.560754</td>\n",
       "      <td>0.537502</td>\n",
       "      <td>0.533419</td>\n",
       "      <td>0.524589</td>\n",
       "      <td>0.533877</td>\n",
       "      <td>0.582502</td>\n",
       "      <td>0.585647</td>\n",
       "      <td>0.560458</td>\n",
       "      <td>...</td>\n",
       "      <td>0.566022</td>\n",
       "      <td>0.545701</td>\n",
       "      <td>0.727293</td>\n",
       "      <td>0.998103</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.997569</td>\n",
       "      <td>0.999427</td>\n",
       "      <td>0.580537</td>\n",
       "      <td>0.604498</td>\n",
       "      <td>0.556299</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>SARS-CoV-2/IND2</th>\n",
       "      <td>0.569493</td>\n",
       "      <td>0.553917</td>\n",
       "      <td>0.560548</td>\n",
       "      <td>0.538426</td>\n",
       "      <td>0.532940</td>\n",
       "      <td>0.526115</td>\n",
       "      <td>0.532928</td>\n",
       "      <td>0.583773</td>\n",
       "      <td>0.584823</td>\n",
       "      <td>0.559830</td>\n",
       "      <td>...</td>\n",
       "      <td>0.566721</td>\n",
       "      <td>0.546263</td>\n",
       "      <td>0.726386</td>\n",
       "      <td>0.999031</td>\n",
       "      <td>0.997569</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.997324</td>\n",
       "      <td>0.581599</td>\n",
       "      <td>0.603594</td>\n",
       "      <td>0.555579</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>SARS-CoV-2/USA/AL</th>\n",
       "      <td>0.569774</td>\n",
       "      <td>0.554496</td>\n",
       "      <td>0.559151</td>\n",
       "      <td>0.537993</td>\n",
       "      <td>0.533549</td>\n",
       "      <td>0.524838</td>\n",
       "      <td>0.534290</td>\n",
       "      <td>0.582919</td>\n",
       "      <td>0.585937</td>\n",
       "      <td>0.560307</td>\n",
       "      <td>...</td>\n",
       "      <td>0.565553</td>\n",
       "      <td>0.545905</td>\n",
       "      <td>0.727472</td>\n",
       "      <td>0.997713</td>\n",
       "      <td>0.999427</td>\n",
       "      <td>0.997324</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.581675</td>\n",
       "      <td>0.604660</td>\n",
       "      <td>0.556387</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>VV</th>\n",
       "      <td>0.582249</td>\n",
       "      <td>0.510400</td>\n",
       "      <td>0.542935</td>\n",
       "      <td>0.538473</td>\n",
       "      <td>0.505114</td>\n",
       "      <td>0.534670</td>\n",
       "      <td>0.555293</td>\n",
       "      <td>0.620861</td>\n",
       "      <td>0.621845</td>\n",
       "      <td>0.605856</td>\n",
       "      <td>...</td>\n",
       "      <td>0.558850</td>\n",
       "      <td>0.531494</td>\n",
       "      <td>0.600216</td>\n",
       "      <td>0.581480</td>\n",
       "      <td>0.580537</td>\n",
       "      <td>0.581599</td>\n",
       "      <td>0.581675</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.921251</td>\n",
       "      <td>0.558802</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Variola virus</th>\n",
       "      <td>0.594740</td>\n",
       "      <td>0.525899</td>\n",
       "      <td>0.548989</td>\n",
       "      <td>0.539484</td>\n",
       "      <td>0.510359</td>\n",
       "      <td>0.537287</td>\n",
       "      <td>0.552597</td>\n",
       "      <td>0.630542</td>\n",
       "      <td>0.632663</td>\n",
       "      <td>0.625449</td>\n",
       "      <td>...</td>\n",
       "      <td>0.573780</td>\n",
       "      <td>0.549620</td>\n",
       "      <td>0.626422</td>\n",
       "      <td>0.603974</td>\n",
       "      <td>0.604498</td>\n",
       "      <td>0.603594</td>\n",
       "      <td>0.604660</td>\n",
       "      <td>0.921251</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.560636</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Zika virus</th>\n",
       "      <td>0.541225</td>\n",
       "      <td>0.501666</td>\n",
       "      <td>0.520352</td>\n",
       "      <td>0.488926</td>\n",
       "      <td>0.502136</td>\n",
       "      <td>0.526243</td>\n",
       "      <td>0.537866</td>\n",
       "      <td>0.546510</td>\n",
       "      <td>0.555958</td>\n",
       "      <td>0.538801</td>\n",
       "      <td>...</td>\n",
       "      <td>0.532405</td>\n",
       "      <td>0.518027</td>\n",
       "      <td>0.558093</td>\n",
       "      <td>0.556155</td>\n",
       "      <td>0.556299</td>\n",
       "      <td>0.555579</td>\n",
       "      <td>0.556387</td>\n",
       "      <td>0.558802</td>\n",
       "      <td>0.560636</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>42 rows × 42 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                         Chikungunya virus  Coxsackievirus B5  Ebola virus  \\\n",
       "d2star                                                                       \n",
       "Chikungunya virus                 1.000000           0.516603     0.532395   \n",
       "Coxsackievirus B5                 0.516603           1.000000     0.513568   \n",
       "Ebola virus                       0.532395           0.513568     1.000000   \n",
       "Enterovirus D                     0.519898           0.570859     0.503441   \n",
       "Enterovirus J                     0.508609           0.557930     0.498397   \n",
       "HBV                               0.521714           0.516581     0.509264   \n",
       "HCV                               0.539485           0.488933     0.535986   \n",
       "HHV-1                             0.579950           0.542364     0.536519   \n",
       "HHV-2                             0.575516           0.527871     0.551883   \n",
       "HHV-3                             0.548850           0.500370     0.529696   \n",
       "HHV-4                             0.556191           0.521696     0.528878   \n",
       "HHV-5                             0.603756           0.536704     0.573636   \n",
       "HHV-6B                            0.545105           0.497999     0.537894   \n",
       "HHV-8                             0.585898           0.544797     0.546030   \n",
       "HIV-1                             0.527765           0.490831     0.535352   \n",
       "HIV-2                             0.550270           0.506106     0.526720   \n",
       "HPIV-2                            0.500118           0.505537     0.558169   \n",
       "HPIV-3                            0.530805           0.510299     0.525593   \n",
       "HPV                               0.511945           0.501181     0.529703   \n",
       "HRV-A                             0.521557           0.557734     0.528037   \n",
       "HRV-B                             0.499875           0.535269     0.514640   \n",
       "HTLV-1                            0.501660           0.493729     0.529036   \n",
       "Hantaan orthohantavirus           0.521041           0.522319     0.534352   \n",
       "Hendra virus                      0.535607           0.523883     0.553989   \n",
       "Human adenovirus                  0.569519           0.498210     0.546800   \n",
       "Human polyomavirus                0.525485           0.515644     0.537408   \n",
       "Influenza A virus                 0.505682           0.512410     0.502796   \n",
       "Influenza B virus                 0.507271           0.514054     0.535551   \n",
       "Influenza C virus                 0.533277           0.495948     0.533297   \n",
       "Lassa mammarenavirus              0.512534           0.517264     0.535780   \n",
       "MCV                               0.555728           0.519451     0.553710   \n",
       "MERS-CoV                          0.544573           0.529717     0.531314   \n",
       "Nipah virus                       0.530703           0.541211     0.539395   \n",
       "RSV                               0.523285           0.523202     0.520057   \n",
       "SARS-CoV                          0.555768           0.540989     0.557383   \n",
       "SARS-CoV-2                        0.570482           0.553558     0.559995   \n",
       "SARS-CoV-2/BHR                    0.571042           0.553633     0.560754   \n",
       "SARS-CoV-2/IND2                   0.569493           0.553917     0.560548   \n",
       "SARS-CoV-2/USA/AL                 0.569774           0.554496     0.559151   \n",
       "VV                                0.582249           0.510400     0.542935   \n",
       "Variola virus                     0.594740           0.525899     0.548989   \n",
       "Zika virus                        0.541225           0.501666     0.520352   \n",
       "\n",
       "                         Enterovirus D  Enterovirus J       HBV       HCV  \\\n",
       "d2star                                                                      \n",
       "Chikungunya virus             0.519898       0.508609  0.521714  0.539485   \n",
       "Coxsackievirus B5             0.570859       0.557930  0.516581  0.488933   \n",
       "Ebola virus                   0.503441       0.498397  0.509264  0.535986   \n",
       "Enterovirus D                 1.000000       0.559862  0.522836  0.474324   \n",
       "Enterovirus J                 0.559862       1.000000  0.506899  0.484325   \n",
       "HBV                           0.522836       0.506899  1.000000  0.509182   \n",
       "HCV                           0.474324       0.484325  0.509182  1.000000   \n",
       "HHV-1                         0.530538       0.502548  0.538787  0.601197   \n",
       "HHV-2                         0.520856       0.504797  0.544751  0.610380   \n",
       "HHV-3                         0.524424       0.499448  0.520635  0.565284   \n",
       "HHV-4                         0.528164       0.544281  0.518547  0.562101   \n",
       "HHV-5                         0.522022       0.512548  0.552126  0.622329   \n",
       "HHV-6B                        0.498315       0.496539  0.524471  0.568921   \n",
       "HHV-8                         0.536158       0.531798  0.528193  0.583633   \n",
       "HIV-1                         0.525733       0.517266  0.502090  0.521066   \n",
       "HIV-2                         0.508127       0.518558  0.526467  0.518988   \n",
       "HPIV-2                        0.497506       0.495492  0.506574  0.525639   \n",
       "HPIV-3                        0.524923       0.519557  0.497884  0.505323   \n",
       "HPV                           0.497422       0.503524  0.528207  0.523119   \n",
       "HRV-A                         0.546739       0.562568  0.497736  0.502146   \n",
       "HRV-B                         0.563810       0.564548  0.507214  0.492007   \n",
       "HTLV-1                        0.507097       0.509284  0.507088  0.509075   \n",
       "Hantaan orthohantavirus       0.508605       0.495211  0.525732  0.511932   \n",
       "Hendra virus                  0.524192       0.529963  0.525165  0.542898   \n",
       "Human adenovirus              0.522306       0.491636  0.526842  0.606443   \n",
       "Human polyomavirus            0.511688       0.485437  0.536040  0.522992   \n",
       "Influenza A virus             0.521183       0.515899  0.505161  0.492594   \n",
       "Influenza B virus             0.522278       0.533802  0.509814  0.491391   \n",
       "Influenza C virus             0.537011       0.541125  0.521881  0.503351   \n",
       "Lassa mammarenavirus          0.512673       0.513018  0.505781  0.503310   \n",
       "MCV                           0.493761       0.534010  0.540400  0.626379   \n",
       "MERS-CoV                      0.520923       0.542819  0.518922  0.510463   \n",
       "Nipah virus                   0.513799       0.522267  0.527798  0.529315   \n",
       "RSV                           0.503035       0.527416  0.513848  0.525334   \n",
       "SARS-CoV                      0.539165       0.548926  0.522710  0.533091   \n",
       "SARS-CoV-2                    0.538074       0.533067  0.525323  0.533642   \n",
       "SARS-CoV-2/BHR                0.537502       0.533419  0.524589  0.533877   \n",
       "SARS-CoV-2/IND2               0.538426       0.532940  0.526115  0.532928   \n",
       "SARS-CoV-2/USA/AL             0.537993       0.533549  0.524838  0.534290   \n",
       "VV                            0.538473       0.505114  0.534670  0.555293   \n",
       "Variola virus                 0.539484       0.510359  0.537287  0.552597   \n",
       "Zika virus                    0.488926       0.502136  0.526243  0.537866   \n",
       "\n",
       "                            HHV-1     HHV-2     HHV-3  ...  Nipah virus  \\\n",
       "d2star                                                 ...                \n",
       "Chikungunya virus        0.579950  0.575516  0.548850  ...     0.530703   \n",
       "Coxsackievirus B5        0.542364  0.527871  0.500370  ...     0.541211   \n",
       "Ebola virus              0.536519  0.551883  0.529696  ...     0.539395   \n",
       "Enterovirus D            0.530538  0.520856  0.524424  ...     0.513799   \n",
       "Enterovirus J            0.502548  0.504797  0.499448  ...     0.522267   \n",
       "HBV                      0.538787  0.544751  0.520635  ...     0.527798   \n",
       "HCV                      0.601197  0.610380  0.565284  ...     0.529315   \n",
       "HHV-1                    1.000000  0.923709  0.664674  ...     0.561140   \n",
       "HHV-2                    0.923709  1.000000  0.654162  ...     0.562328   \n",
       "HHV-3                    0.664674  0.654162  1.000000  ...     0.514074   \n",
       "HHV-4                    0.751015  0.763389  0.639311  ...     0.536755   \n",
       "HHV-5                    0.805508  0.832868  0.634040  ...     0.576293   \n",
       "HHV-6B                   0.628677  0.629655  0.634080  ...     0.511283   \n",
       "HHV-8                    0.743176  0.744011  0.650543  ...     0.536298   \n",
       "HIV-1                    0.547129  0.564710  0.522266  ...     0.518055   \n",
       "HIV-2                    0.549193  0.568534  0.562429  ...     0.515225   \n",
       "HPIV-2                   0.547037  0.567750  0.532054  ...     0.570627   \n",
       "HPIV-3                   0.549225  0.557101  0.529184  ...     0.557822   \n",
       "HPV                      0.539370  0.554519  0.588628  ...     0.519142   \n",
       "HRV-A                    0.557879  0.558792  0.524480  ...     0.536252   \n",
       "HRV-B                    0.555949  0.546299  0.536300  ...     0.504971   \n",
       "HTLV-1                   0.548994  0.562491  0.538997  ...     0.531234   \n",
       "Hantaan orthohantavirus  0.520780  0.507603  0.478137  ...     0.511735   \n",
       "Hendra virus             0.560089  0.567557  0.521381  ...     0.614084   \n",
       "Human adenovirus         0.722914  0.745194  0.630264  ...     0.539682   \n",
       "Human polyomavirus       0.556156  0.565274  0.560539  ...     0.533111   \n",
       "Influenza A virus        0.503788  0.514423  0.503637  ...     0.526910   \n",
       "Influenza B virus        0.520589  0.526030  0.511440  ...     0.534239   \n",
       "Influenza C virus        0.538163  0.540882  0.551409  ...     0.538158   \n",
       "Lassa mammarenavirus     0.507440  0.521164  0.504545  ...     0.530432   \n",
       "MCV                      0.714524  0.759096  0.552874  ...     0.538342   \n",
       "MERS-CoV                 0.571731  0.569016  0.540457  ...     0.540172   \n",
       "Nipah virus              0.561140  0.562328  0.514074  ...     1.000000   \n",
       "RSV                      0.533397  0.533808  0.555458  ...     0.547071   \n",
       "SARS-CoV                 0.590993  0.588871  0.519492  ...     0.573436   \n",
       "SARS-CoV-2               0.583255  0.585227  0.560829  ...     0.566552   \n",
       "SARS-CoV-2/BHR           0.582502  0.585647  0.560458  ...     0.566022   \n",
       "SARS-CoV-2/IND2          0.583773  0.584823  0.559830  ...     0.566721   \n",
       "SARS-CoV-2/USA/AL        0.582919  0.585937  0.560307  ...     0.565553   \n",
       "VV                       0.620861  0.621845  0.605856  ...     0.558850   \n",
       "Variola virus            0.630542  0.632663  0.625449  ...     0.573780   \n",
       "Zika virus               0.546510  0.555958  0.538801  ...     0.532405   \n",
       "\n",
       "                              RSV  SARS-CoV  SARS-CoV-2  SARS-CoV-2/BHR  \\\n",
       "d2star                                                                    \n",
       "Chikungunya virus        0.523285  0.555768    0.570482        0.571042   \n",
       "Coxsackievirus B5        0.523202  0.540989    0.553558        0.553633   \n",
       "Ebola virus              0.520057  0.557383    0.559995        0.560754   \n",
       "Enterovirus D            0.503035  0.539165    0.538074        0.537502   \n",
       "Enterovirus J            0.527416  0.548926    0.533067        0.533419   \n",
       "HBV                      0.513848  0.522710    0.525323        0.524589   \n",
       "HCV                      0.525334  0.533091    0.533642        0.533877   \n",
       "HHV-1                    0.533397  0.590993    0.583255        0.582502   \n",
       "HHV-2                    0.533808  0.588871    0.585227        0.585647   \n",
       "HHV-3                    0.555458  0.519492    0.560829        0.560458   \n",
       "HHV-4                    0.537795  0.581425    0.582750        0.583601   \n",
       "HHV-5                    0.542026  0.610185    0.604332        0.605006   \n",
       "HHV-6B                   0.530657  0.544347    0.532837        0.532238   \n",
       "HHV-8                    0.533905  0.576323    0.560440        0.560679   \n",
       "HIV-1                    0.516068  0.564588    0.545504        0.545667   \n",
       "HIV-2                    0.515360  0.545250    0.549069        0.548837   \n",
       "HPIV-2                   0.546678  0.542142    0.549142        0.548397   \n",
       "HPIV-3                   0.529475  0.541224    0.558373        0.557612   \n",
       "HPV                      0.498829  0.524642    0.546315        0.547265   \n",
       "HRV-A                    0.499902  0.546831    0.559648        0.559558   \n",
       "HRV-B                    0.498305  0.520603    0.518662        0.519367   \n",
       "HTLV-1                   0.512965  0.520243    0.509667        0.509969   \n",
       "Hantaan orthohantavirus  0.500426  0.515701    0.520731        0.520616   \n",
       "Hendra virus             0.549513  0.570181    0.558101        0.557423   \n",
       "Human adenovirus         0.532778  0.569111    0.558859        0.559464   \n",
       "Human polyomavirus       0.501263  0.525851    0.544628        0.544768   \n",
       "Influenza A virus        0.506141  0.524090    0.500943        0.500665   \n",
       "Influenza B virus        0.515936  0.579757    0.563785        0.563242   \n",
       "Influenza C virus        0.496256  0.543968    0.533582        0.533990   \n",
       "Lassa mammarenavirus     0.509559  0.527542    0.549456        0.549439   \n",
       "MCV                      0.506792  0.577606    0.550753        0.550825   \n",
       "MERS-CoV                 0.545235  0.643252    0.644644        0.645560   \n",
       "Nipah virus              0.547071  0.573436    0.566552        0.566022   \n",
       "RSV                      1.000000  0.544726    0.546554        0.545701   \n",
       "SARS-CoV                 0.544726  1.000000    0.728346        0.727293   \n",
       "SARS-CoV-2               0.546554  0.728346    1.000000        0.998103   \n",
       "SARS-CoV-2/BHR           0.545701  0.727293    0.998103        1.000000   \n",
       "SARS-CoV-2/IND2          0.546263  0.726386    0.999031        0.997569   \n",
       "SARS-CoV-2/USA/AL        0.545905  0.727472    0.997713        0.999427   \n",
       "VV                       0.531494  0.600216    0.581480        0.580537   \n",
       "Variola virus            0.549620  0.626422    0.603974        0.604498   \n",
       "Zika virus               0.518027  0.558093    0.556155        0.556299   \n",
       "\n",
       "                         SARS-CoV-2/IND2  SARS-CoV-2/USA/AL        VV  \\\n",
       "d2star                                                                  \n",
       "Chikungunya virus               0.569493           0.569774  0.582249   \n",
       "Coxsackievirus B5               0.553917           0.554496  0.510400   \n",
       "Ebola virus                     0.560548           0.559151  0.542935   \n",
       "Enterovirus D                   0.538426           0.537993  0.538473   \n",
       "Enterovirus J                   0.532940           0.533549  0.505114   \n",
       "HBV                             0.526115           0.524838  0.534670   \n",
       "HCV                             0.532928           0.534290  0.555293   \n",
       "HHV-1                           0.583773           0.582919  0.620861   \n",
       "HHV-2                           0.584823           0.585937  0.621845   \n",
       "HHV-3                           0.559830           0.560307  0.605856   \n",
       "HHV-4                           0.583483           0.582473  0.608974   \n",
       "HHV-5                           0.603799           0.605022  0.669318   \n",
       "HHV-6B                          0.533615           0.533158  0.587750   \n",
       "HHV-8                           0.561032           0.560840  0.634755   \n",
       "HIV-1                           0.545093           0.545330  0.563069   \n",
       "HIV-2                           0.549236           0.549529  0.558640   \n",
       "HPIV-2                          0.548633           0.549739  0.547799   \n",
       "HPIV-3                          0.558473           0.558124  0.529867   \n",
       "HPV                             0.545504           0.546802  0.541400   \n",
       "HRV-A                           0.558662           0.559220  0.527702   \n",
       "HRV-B                           0.518346           0.518129  0.536627   \n",
       "HTLV-1                          0.509796           0.509268  0.534313   \n",
       "Hantaan orthohantavirus         0.520726           0.520610  0.518196   \n",
       "Hendra virus                    0.558382           0.557408  0.551098   \n",
       "Human adenovirus                0.558693           0.558086  0.606433   \n",
       "Human polyomavirus              0.545438           0.544376  0.552531   \n",
       "Influenza A virus               0.500551           0.501633  0.510801   \n",
       "Influenza B virus               0.564155           0.563298  0.571046   \n",
       "Influenza C virus               0.534230           0.532767  0.554829   \n",
       "Lassa mammarenavirus            0.548870           0.548885  0.549818   \n",
       "MCV                             0.550480           0.550728  0.551336   \n",
       "MERS-CoV                        0.644940           0.645169  0.586605   \n",
       "Nipah virus                     0.566721           0.565553  0.558850   \n",
       "RSV                             0.546263           0.545905  0.531494   \n",
       "SARS-CoV                        0.726386           0.727472  0.600216   \n",
       "SARS-CoV-2                      0.999031           0.997713  0.581480   \n",
       "SARS-CoV-2/BHR                  0.997569           0.999427  0.580537   \n",
       "SARS-CoV-2/IND2                 1.000000           0.997324  0.581599   \n",
       "SARS-CoV-2/USA/AL               0.997324           1.000000  0.581675   \n",
       "VV                              0.581599           0.581675  1.000000   \n",
       "Variola virus                   0.603594           0.604660  0.921251   \n",
       "Zika virus                      0.555579           0.556387  0.558802   \n",
       "\n",
       "                         Variola virus  Zika virus  \n",
       "d2star                                              \n",
       "Chikungunya virus             0.594740    0.541225  \n",
       "Coxsackievirus B5             0.525899    0.501666  \n",
       "Ebola virus                   0.548989    0.520352  \n",
       "Enterovirus D                 0.539484    0.488926  \n",
       "Enterovirus J                 0.510359    0.502136  \n",
       "HBV                           0.537287    0.526243  \n",
       "HCV                           0.552597    0.537866  \n",
       "HHV-1                         0.630542    0.546510  \n",
       "HHV-2                         0.632663    0.555958  \n",
       "HHV-3                         0.625449    0.538801  \n",
       "HHV-4                         0.624289    0.535054  \n",
       "HHV-5                         0.686044    0.576288  \n",
       "HHV-6B                        0.600244    0.551489  \n",
       "HHV-8                         0.663804    0.562551  \n",
       "HIV-1                         0.576860    0.537206  \n",
       "HIV-2                         0.568388    0.519396  \n",
       "HPIV-2                        0.560852    0.527757  \n",
       "HPIV-3                        0.544899    0.526766  \n",
       "HPV                           0.575034    0.510152  \n",
       "HRV-A                         0.537124    0.503093  \n",
       "HRV-B                         0.535328    0.503093  \n",
       "HTLV-1                        0.543082    0.520954  \n",
       "Hantaan orthohantavirus       0.512523    0.523055  \n",
       "Hendra virus                  0.556279    0.522019  \n",
       "Human adenovirus              0.634814    0.539465  \n",
       "Human polyomavirus            0.553858    0.534483  \n",
       "Influenza A virus             0.532387    0.522643  \n",
       "Influenza B virus             0.591862    0.526752  \n",
       "Influenza C virus             0.571070    0.514296  \n",
       "Lassa mammarenavirus          0.555074    0.520639  \n",
       "MCV                           0.560594    0.544827  \n",
       "MERS-CoV                      0.600338    0.556616  \n",
       "Nipah virus                   0.573780    0.532405  \n",
       "RSV                           0.549620    0.518027  \n",
       "SARS-CoV                      0.626422    0.558093  \n",
       "SARS-CoV-2                    0.603974    0.556155  \n",
       "SARS-CoV-2/BHR                0.604498    0.556299  \n",
       "SARS-CoV-2/IND2               0.603594    0.555579  \n",
       "SARS-CoV-2/USA/AL             0.604660    0.556387  \n",
       "VV                            0.921251    0.558802  \n",
       "Variola virus                 1.000000    0.560636  \n",
       "Zika virus                    0.560636    1.000000  \n",
       "\n",
       "[42 rows x 42 columns]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "DVA_virus_virus_sim_df = pd.read_csv('../data/similarity_virus.csv')\n",
    "DVA_virus_virus_sim_df.index = DVA_virus_virus_sim_df['d2star']\n",
    "DVA_virus_virus_sim_df = DVA_virus_virus_sim_df.drop(columns=['d2star'], axis = 1)\n",
    "DVA_virus_virus_sim_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "e79b846d",
   "metadata": {},
   "outputs": [],
   "source": [
    "DVA_drug_virus_interaction_df.index = DVA_virus_virus_sim_df.index\n",
    "virus_names = DVA_drug_virus_interaction_df.index"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "4310e4da",
   "metadata": {},
   "outputs": [],
   "source": [
    "import scipy.io as sio\n",
    "sio.savemat('vir_sim_matrix1.mat',{'Sv':DVA_virus_virus_sim_df.values , 'vi_names':DVA_virus_virus_sim_df.index.values})"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7fe34a20",
   "metadata": {},
   "source": [
    "# WGRMF implementation"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "4a7411cb",
   "metadata": {},
   "outputs": [],
   "source": [
    "import random\n",
    "import copy\n",
    "from scipy.sparse.linalg import svds\n",
    "from sklearn.metrics import roc_auc_score\n",
    "from sklearn.metrics import average_precision_score\n",
    "from scipy.linalg import sqrtm\n",
    "from scipy.linalg import fractional_matrix_power"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 256,
   "id": "021649b8",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "m = \n",
      " 1\n",
      "n = \n",
      " 10\n",
      "[9261]\n",
      "==========================\n",
      "****\n",
      "k%g\t\t%g\t%g\t%g\t\t 50 0.25 0.1 0.01\n",
      "****\n",
      "k%g\t\t%g\t%g\t%g\t\t 50 0.25 0.1 0.01\n",
      "****\n",
      "k%g\t\t%g\t%g\t%g\t\t 50 0.25 0.1 0.01\n",
      "****\n",
      "k%g\t\t%g\t%g\t%g\t\t 50 0.25 0.1 0.01\n",
      "****\n",
      "k%g\t\t%g\t%g\t%g\t\t 50 0.25 0.1 0.01\n",
      "****\n",
      "k%g\t\t%g\t%g\t%g\t\t 50 0.25 0.1 0.01\n",
      "****\n",
      "k%g\t\t%g\t%g\t%g\t\t 50 0.25 0.1 0.01\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_17380\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_17380\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_17380\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_17380\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_17380\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_17380\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "****\n",
      "k%g\t\t%g\t%g\t%g\t\t 50 0.25 0.1 0.01\n",
      "****\n",
      "k%g\t\t%g\t%g\t%g\t\t 50 0.25 0.1 0.01\n",
      "****\n",
      "k%g\t\t%g\t%g\t%g\t\t 50 0.25 0.1 0.01\n",
      "\n",
      "\n",
      "      AUC: %g\n",
      " 0.8520543478341673\n",
      "     AUPR: %g\n",
      " 0.4162240400072469\n",
      "      AUC: %g\n",
      " 0.04274790970620938\n",
      "     AUPR: %g\n",
      " 0.1062037937003936\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_17380\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_17380\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_17380\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_17380\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n"
     ]
    }
   ],
   "source": [
    "crossval(DVA_drug_virus_interaction_df.values.T, DVA_drug_drug_sim_df.values, DVA_virus_virus_sim_df.values, 'WGRMF', 'cv_p',1,10,True,5, 0.7,True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 272,
   "id": "90585039",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "m = \n",
      " 1\n",
      "n = \n",
      " 10\n",
      "[2461]\n",
      "==========================\n",
      "****\n",
      "k%g\t\t%g\t%g\t%g\t\t 50 2 0.1 0.1\n",
      "****\n",
      "k%g\t\t%g\t%g\t%g\t\t 50 2 0.1 0.1\n",
      "****\n",
      "k%g\t\t%g\t%g\t%g\t\t 50 2 0.1 0.1\n",
      "****\n",
      "k%g\t\t%g\t%g\t%g\t\t 50 2 0.1 0.1\n",
      "****\n",
      "k%g\t\t%g\t%g\t%g\t\t 50 2 0.1 0.1\n",
      "****\n",
      "k%g\t\t%g\t%g\t%g\t\t 50 2 0.1 0.1\n",
      "****\n",
      "k%g\t\t%g\t%g\t%g\t\t 50 2 0.1 0.1\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_17380\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_17380\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_17380\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_17380\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_17380\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_17380\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "****\n",
      "k%g\t\t%g\t%g\t%g\t\t 50 2 0.1 0.1\n",
      "****\n",
      "k%g\t\t%g\t%g\t%g\t\t 50 2 0.1 0.1\n",
      "****\n",
      "k%g\t\t%g\t%g\t%g\t\t 50 2 0.1 0.1\n",
      "\n",
      "\n",
      "      AUC: %g\n",
      " 0.7565368387878407\n",
      "     AUPR: %g\n",
      " 0.41442910082520595\n",
      "      AUC: %g\n",
      " 0.0917955700667107\n",
      "     AUPR: %g\n",
      " 0.12186465262842239\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_17380\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_17380\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_17380\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_17380\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n"
     ]
    }
   ],
   "source": [
    "crossval(DVA_drug_virus_interaction_df.values.T, DVA_drug_drug_sim_df.values, DVA_virus_virus_sim_df.values, 'WGRMF', 'cv_d',1,10,True,5, 0.7,True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 271,
   "id": "69a4af47",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "m = \n",
      " 1\n",
      "n = \n",
      " 10\n",
      "[8581]\n",
      "==========================\n",
      "****\n",
      "k%g\t\t%g\t%g\t%g\t\t 50 2 0.1 0.1\n",
      "****\n",
      "k%g\t\t%g\t%g\t%g\t\t 50 2 0.1 0.1\n",
      "****\n",
      "k%g\t\t%g\t%g\t%g\t\t 50 2 0.1 0.1\n",
      "****\n",
      "k%g\t\t%g\t%g\t%g\t\t 50 2 0.1 0.1\n",
      "****\n",
      "k%g\t\t%g\t%g\t%g\t\t 50 2 0.1 0.1\n",
      "****\n",
      "k%g\t\t%g\t%g\t%g\t\t 50 2 0.1 0.1\n",
      "****\n",
      "k%g\t\t%g\t%g\t%g\t\t 50 2 0.1 0.1\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_17380\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_17380\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_17380\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_17380\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_17380\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_17380\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_17380\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "****\n",
      "k%g\t\t%g\t%g\t%g\t\t 50 2 0.1 0.1\n",
      "****\n",
      "k%g\t\t%g\t%g\t%g\t\t 50 2 0.1 0.1\n",
      "****\n",
      "k%g\t\t%g\t%g\t%g\t\t 50 2 0.1 0.1\n",
      "\n",
      "\n",
      "      AUC: %g\n",
      " 0.846206608151215\n",
      "     AUPR: %g\n",
      " 0.4784031494748323\n",
      "      AUC: %g\n",
      " 0.12065475913728002\n",
      "     AUPR: %g\n",
      " 0.2047841908685334\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_17380\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_17380\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_17380\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n"
     ]
    }
   ],
   "source": [
    "crossval(DVA_drug_virus_interaction_df.values.T, DVA_drug_drug_sim_df.values, DVA_virus_virus_sim_df.values, 'WGRMF', 'cv_v',1,10,True,5, 0.7,True)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c4c1f286",
   "metadata": {},
   "source": [
    "# Crossval"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "a5ba54c9",
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "def crossval(Y,Sd,St,classifier,cv_setting,m,n,use_WKNKN,K,eta,use_W_matrix):\n",
    "# \n",
    "# INPUT:\n",
    "# Y:           matrix to be modified\n",
    "# Sd:          pairwise drug similarities matrix\n",
    "# St:          pairwise target similarities matrix\n",
    "# classifier:  algorithm to be used for DTI prediction\n",
    "# cv_setting:  cross validation setting ('cv_d', 'cv_t' or 'cv_p')\n",
    "# m:           number of repetitions of n-fold cross validation\n",
    "# n:           number of folds in each n-fold cross validation\n",
    "\n",
    "#     parameters\n",
    "    print('m = \\n',m)     #repetitions\n",
    "    print('n = \\n',n)     #folds\n",
    "\n",
    "#     seeds\n",
    "    seeds = [9261]\n",
    "#     seeds = []\n",
    "#     for i in range(m):\n",
    "#         r = random.randint(1,10000)\n",
    "#         seeds.append(r)\n",
    "        \n",
    "#     print(seeds)\n",
    "#     print('==========================')\n",
    "\n",
    "\n",
    "\n",
    "#     cross validation (m repetitions of n-fold experiments)\n",
    "#     AUCs  = []\n",
    "#     AUPRs = []\n",
    "    for i in range(m):\n",
    "        seed = seeds[i]\n",
    "#         AUCi, AUPRi = nfold(Y,Sd,St,classifier,n,seed,cv_setting,use_WKNKN,K,eta,use_W_matrix)\n",
    "        nfold(Y,Sd,St,classifier,n,seed,cv_setting,use_WKNKN,K,eta,use_W_matrix)\n",
    "#         AUCs.append(AUCi)\n",
    "#         AUPRs.append(AUPRi)\n",
    "    \n",
    "\n",
    "\n",
    "# #     display evaluation results\n",
    "#     print('\\n FINAL AVERAGED RESULTS\\n\\n')\n",
    "#     print('     AUC (std): %g\\t(%g)\\n',   mean(np.array(AUCs)),  std(np.array(AUCs)))\n",
    "#     print('    AUPR (std): %g\\t(%g)\\n',   mean(np.array(AUPRs)), std(np.array(AUPRs)))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e4310d9e",
   "metadata": {},
   "source": [
    "# nfold"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "6b6b2d27",
   "metadata": {},
   "outputs": [],
   "source": [
    "def nfold(Y,Sd,St,classifier,nr_fold,seed,cv_setting,use_WKNKN,K,eta,use_W_matrix):\n",
    "# nfold is a helper function of crossValidation.m. Depending on the\n",
    "# specified CV setting (or scenario) and supplied \"seed\", it divides the\n",
    "# interaction matrix into \"nr_fold\" folds, performs a cross validation\n",
    "# experiment and then reports the results (AUPR/AUC) back to\n",
    "# crossValidation.m.\n",
    "# \n",
    "# INPUT:\n",
    "#  Y:           matrix to be modified\n",
    "#  Sd:          pairwise row similarities matrix\n",
    "#  St:          pairwise column similarities matrix\n",
    "#  classifier:     function/script of algorithm to be used for DTI prediction\n",
    "#  nr_fold:     number of folds in cross validation experiment\n",
    "#  seed:        seed used for random sampling\n",
    "#  cv_setting:  drug prediction case or target prediction case\n",
    "# \n",
    "# OUTPUT:\n",
    "#  auc_res:     AUC result\n",
    "#  aupr_res:    AUPR result\n",
    "# \n",
    "\n",
    "    num_drugs,num_targets = Y.shape;\n",
    "    if (cv_setting =='cv_p'):\n",
    "        num = Y.size\n",
    "    elif (cv_setting =='cv_d'):\n",
    "        num = num_drugs\n",
    "    elif (cv_setting =='cv_v'):\n",
    "        num = num_targets\n",
    "    else:\n",
    "        print('error')\n",
    "    \n",
    "#     rng('default')\n",
    "#     rng(seed);\n",
    "#     rand_ind = randperm(len);\n",
    "\n",
    "    AUCs  = []\n",
    "    AUPRs = []\n",
    "    for i in range(nr_fold):\n",
    "#         leave out random drug-target pairs\n",
    "        global rand_ind\n",
    "        if (cv_setting == 'cv_p'):\n",
    "            rand_ind = []\n",
    "            for d in range(num_drugs):\n",
    "                for v in range(num_targets):\n",
    "                    rand_ind.append((d,v))\n",
    "            random.seed(seed)\n",
    "            random.shuffle(rand_ind)\n",
    "\n",
    "#         leave out random entire drugs\n",
    "#         leave out random entire targets\n",
    "        elif (cv_setting == 'cv_d' or cv_setting == 'cv_v'):\n",
    "            rand_ind=np.random.RandomState(seed=seed).permutation(num).tolist()\n",
    "#             print(rand_ind)\n",
    "        \n",
    "        test_ind=rand_ind[(math.floor(np.dot((i),num) / nr_fold)):(math.floor(np.dot(i+1,num) / nr_fold))]\n",
    "        \n",
    "\n",
    "#         predict with test set being left out\n",
    "        y2=copy.deepcopy(Y)\n",
    "        if (cv_setting == 'cv_p' or cv_setting == 'cv_d'):\n",
    "            for i in test_ind:\n",
    "                y2[i] = 0     # test set = ZERO\n",
    "        elif (cv_setting == 'cv_v'):\n",
    "            for i in test_ind:\n",
    "                y2[:,i] = 0\n",
    "#         print('****')\n",
    "        if classifier == 'WGRMF':\n",
    "            y3 = WGRMF(y2,Sd,St,cv_setting,nr_fold,test_ind,use_WKNKN,K,eta,use_W_matrix) # predict!\n",
    "\n",
    "#         compute evaluation metrics based on obtained prediction scores\n",
    "        if (cv_setting == 'cv_p'):\n",
    "            y_true = [Y[i] for i in test_ind]\n",
    "            y_test = [y3[i] for i in test_ind]\n",
    "            auci, aupri = returnEvaluationMetrics(y_true, y_test)\n",
    "        elif (cv_setting == 'cv_d' or cv_setting == 'cv_v'):\n",
    "            y_true = []\n",
    "            y_test = []\n",
    "            for i in test_ind:\n",
    "                for m in Y[i]:\n",
    "                    y_true.append(m)\n",
    "                for n in y3[i]:\n",
    "                    y_test.append(n)\n",
    "            auci, aupri = returnEvaluationMetrics(y_true, y_test)\n",
    "        AUCs.append(auci)\n",
    "        AUPRs.append(aupri)\n",
    "\n",
    "\n",
    "    auc_res = np.mean(np.array(AUCs))\n",
    "    aupr_res = np.mean(np.array(AUPRs))\n",
    "    auc_res1 = np.std(np.array(AUCs))\n",
    "    aupr_res1 = np.std(np.array(AUPRs))\n",
    "    print('\\n')\n",
    "    print('      AUC: %g\\n',   auc_res)\n",
    "    print('     AUPR: %g\\n',   aupr_res)\n",
    "    print('      AUC: %g\\n',   auc_res1)\n",
    "    print('     AUPR: %g\\n',   aupr_res1)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "271a6ec2",
   "metadata": {},
   "source": [
    "# WGRMF"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "4c46e151",
   "metadata": {},
   "outputs": [],
   "source": [
    "def WGRMF(Y,Sd,St,cv_setting,nr_fold,test_ind,use_WKNKN,K,eta,use_W_matrix):\n",
    "\n",
    "# INPUT:\n",
    "#  Y:           interaction matrix\n",
    "#  Sd:          pairwise drug similarities matrix\n",
    "#  St:          pairwise target similarities matrix\n",
    "#  cv_setting:  cross validation setting ('cv_d', 'cv_t' or 'cv_p')\n",
    "#  nr_fold:     number of folds in cross validation experiment\n",
    "#  left_out:    if cv_setting=='cv_d' --> left_out is 'drug' indices that are left out\n",
    "#               if cv_setting=='cv_t' --> left_out is 'target' indices that are left out\n",
    "#               if cv_setting=='cv_p' --> left_out is 'drug-target pair' indices that are left out\n",
    "# \n",
    "# OUTPUT:\n",
    "#  y3:  prediction matrix\n",
    "#     get best parameters\n",
    "    k = 50\n",
    "    lambda_l = 2\n",
    "    lambda_d = 0.1\n",
    "    lambda_t = 0.1\n",
    "    p = 5\n",
    "    num_iter = 2\n",
    "#     print('k%g\\t\\t%g\\t%g\\t%g\\t\\t',k,lambda_l,lambda_d,lambda_t)\n",
    "    \n",
    "#     preprocessing Y\n",
    "    if use_WKNKN:\n",
    "        Y = preprocess_WKNKN(Y,Sd,St,K,eta)\n",
    "\n",
    "#     preprocessing Sd & St\n",
    "    Sd = preprocess_PNN(Sd,p)\n",
    "    St = preprocess_PNN(St,p)\n",
    "\n",
    "#     Laplacian Matrices\n",
    "    Dd = np.diag(Sd.sum(axis = 0))\n",
    "    Dt = np.diag(St.sum(axis = 0))\n",
    "    Ld = Dd - Sd\n",
    "    tmp = np.matmul(fractional_matrix_power(Dd, -0.5),Ld)\n",
    "    Ld = np.matmul(tmp,fractional_matrix_power(Dd, -0.5))\n",
    "    Lt = Dt - St\n",
    "    tmp1 = np.matmul(fractional_matrix_power(Dt, -0.5),Lt)\n",
    "    Lt = np.matmul(tmp1,fractional_matrix_power(Dt, -0.5))\n",
    "\n",
    "#     initialize A & B\n",
    "    A,B = initializer(Y,k)\n",
    "    \n",
    "    W = np.ones(Y.shape)\n",
    "    for i in test_ind:\n",
    "        W[i] = 0\n",
    "    A,B = WGRMF_predict(Y,A,B,Ld,Lt,lambda_l,lambda_d,lambda_t,num_iter,W)\n",
    "    \n",
    "#     compute prediction matrix\n",
    "    y3 = np.matmul(A,B.T)\n",
    "    return y3"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "137345cf",
   "metadata": {},
   "source": [
    "# preprocess_PNN"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "8491c7f1",
   "metadata": {},
   "outputs": [],
   "source": [
    "def preprocess_PNN(s,p):\n",
    "# preprocess_PNN sparsifies the similarity matrix S by keeping, for each\n",
    "# drug/target, the p nearest neighbors and discarding the rest.\n",
    "#     \n",
    "# S = preprocess_PNN(S,p)\n",
    "\n",
    "    NN_mat = np.zeros(s.shape);\n",
    "\n",
    "#     % for each drug/target...\n",
    "    for j in range(NN_mat.shape[0]):\n",
    "        row = copy.deepcopy(s[j,:])                           # get row corresponding to current drug/target\n",
    "        row[j] = 0                             # ignore self-similarity\n",
    "        indx = row.argsort()[::-1][:p]         # sort similarities descendingly, keep p NNs\n",
    "        NN_mat[j,indx] = s[j,indx]             # keep similarities to p NNs\n",
    "        NN_mat[j,j] = s[j,j]                   # also keep the self-similarity (typically 1)\n",
    "\n",
    "#     symmetrize the modified similarity matrix\n",
    "    s = (NN_mat+NN_mat.T)/2\n",
    "    return s"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "523aa0b9",
   "metadata": {},
   "source": [
    "# initializer"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "368ac850",
   "metadata": {},
   "outputs": [],
   "source": [
    "def initializer(Y,k):\n",
    "# initializer initializes the A and B latent feature matrices for the\n",
    "# WGRMF algorithms.\n",
    "# \n",
    "# [A,B] = initializer(Y,K)\n",
    "# \n",
    "# INPUT:\n",
    "#  Y:   interaction matrix to be decomposed into latent feature matrices\n",
    "#  K:   number of latent features\n",
    "# \n",
    "# OUTPUT:\n",
    "#  A:   latent feature matrix for drugs\n",
    "#  B:   latent feature matrix for targets\n",
    "    if k > min(Y.shape):\n",
    "        k = min(Y.shape)-1\n",
    "    u,s,v = svds(Y,k)\n",
    "#     print(u.shape)\n",
    "#     print(s.shape)\n",
    "#     print(v.shape)\n",
    "    s = np.diag(s)\n",
    "    A = np.matmul(u,(fractional_matrix_power(s, 0.5)))\n",
    "    B = np.matmul(v.T,(fractional_matrix_power(s, 0.5)))\n",
    "#     print(A.shape)\n",
    "#     print(B.shape)\n",
    "    \n",
    "    return A,B"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f37d99c6",
   "metadata": {},
   "source": [
    "# WGRMF predict"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "026c4634",
   "metadata": {},
   "outputs": [],
   "source": [
    "def WGRMF_predict(Y,A,B,Ld,Lt,lambda_l,lambda_d,lambda_t,num_iter,W):\n",
    "# alg_grmf_predict is a helper function of WGRMF that executes the\n",
    "# alternating least squares method to obtain the solution.\n",
    "    K = A.shape[1]\n",
    "    lambda_d_Ld = lambda_d*Ld\n",
    "    lambda_t_Lt = lambda_t*Lt\n",
    "    lambda_l_eye_K = lambda_l*np.identity(K)\n",
    "\n",
    "    H = W*Y;\n",
    "    for z in range(num_iter):\n",
    "        A_old = copy.deepcopy(A)\n",
    "        HB_minus_alpha_Ld_A_old = np.matmul(H,B) - np.matmul(lambda_d_Ld,A_old)\n",
    "        for a in range(A.shape[0]):\n",
    "            tmp = np.matmul(B.T,np.diag(W[a,:]))\n",
    "#             print(A[a,:].shape)\n",
    "#             print(HB_minus_alpha_Ld_A_old[a,:].shape)\n",
    "#             print(np.matmul(tmp,B).shape)\n",
    "#             print(lambda_l_eye_K.shape)\n",
    "            A[a,:] = np.linalg.solve((np.matmul(tmp,B) + lambda_l_eye_K).T, HB_minus_alpha_Ld_A_old[a,:].T).T\n",
    "\n",
    "        B_old = B\n",
    "        HtA_minus_beta_Lt_B_old = np.matmul(H.T,A) - np.matmul(lambda_t_Lt,B_old)\n",
    "        for b in range(B.shape[0]):\n",
    "            tmp = np.matmul(A.T,np.diag(W[:,b]))\n",
    "            B[b,:] = np.linalg.solve((np.matmul(tmp,A) + lambda_l_eye_K).T, HtA_minus_beta_Lt_B_old[b,:].T).T\n",
    "            \n",
    "    return A,B"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "42cd7f28",
   "metadata": {},
   "source": [
    "# WKNKN"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "edc59a6e",
   "metadata": {},
   "outputs": [],
   "source": [
    "def preprocess_WKNKN(Y,Sd,St,K,eta):\n",
    "# preprocess_WKNKN preprocesses the interaction matrix Y by replacing each\n",
    "# of the 0's (i.e. presumed non-interactions) with a continuous value\n",
    "# between 0 and 1. For each 0, the K nearest known drugs are used to infer\n",
    "# a value, the K nearest known targets are used to infer another value, and\n",
    "# then the average of the two values is used to replace that 0.\n",
    "\n",
    "# Y = preprocess_WKNKN(Y,Sd,St,K,eta)\n",
    "\n",
    "# INPUT:\n",
    "#  Y:   matrix to be modified\n",
    "#  Sd:  pairwise row similarities matrix\n",
    "#  St:  pairwise column similarities matrix\n",
    "#  K:   number of nearest known neighbors to use\n",
    "#  eta: decay rate\n",
    "\n",
    "# OUTPUT:\n",
    "#  Y:   the modified matrix\n",
    "\n",
    "#     decay values to be used in weighting similarities later\n",
    "    eta = np.array([eta**i for i in range(K)])\n",
    "\n",
    "    y2_new1 = np.zeros(Y.shape)\n",
    "    y2_new2 = np.zeros(Y.shape)\n",
    "    \n",
    "    \n",
    "\n",
    "    empty_rows = np.where(~Y.any(axis=1))   # get indices of empty rows\n",
    "    empty_cols = np.where(~Y.any(axis=0))   # get indices of empty columns\n",
    "\n",
    "#     for each drug i...\n",
    "    for i in range(Sd.shape[0]):\n",
    "        drug_sim = copy.deepcopy(Sd[i,:]) # get similarities of drug i to other drugs\n",
    "        drug_sim[i] = 0    # set self-similiraty to ZERO\n",
    "\n",
    "        drug_sim[empty_rows] = 0  # to drugs of \n",
    "        \n",
    "        indx = drug_sim.argsort()[::-1][:K]     # sort descendingly, keep only similarities of K nearest neighbors \n",
    "#                                                  and their indices\n",
    "\n",
    "#         computed profile of drug i by using its similarities to its K\n",
    "#         nearest neighbors weighted by the decay values from eta\n",
    "        drug_sim = copy.deepcopy(Sd[i,:])\n",
    "        y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
    "#         print(i)\n",
    "#         print(y2_new1[i,:])\n",
    "\n",
    "#     for each target j...\n",
    "    for j in range(St.shape[0]):\n",
    "        target_sim = copy.deepcopy(St[j,:]) # get similarities of target j to other targets\n",
    "        target_sim[j] = 0    # set self-similiraty to ZERO\n",
    "\n",
    "        target_sim[empty_cols] = 0    # to targets of empty columns\n",
    "\n",
    "        indx = target_sim.argsort()[::-1][:K]  # sort descendingly, keep only similarities of K nearest neighbors\n",
    "#                                                 and their indices\n",
    "\n",
    "#         computed profile of target j by using its similarities to its K\n",
    "#         nearest neighbors weighted by the decay values from eta\n",
    "        target_sim = copy.deepcopy(St[j,:])\n",
    "        y2_new2[:,j] = np.matmul(Y[:,indx] ,(eta * target_sim[indx]).T )/ target_sim[indx].sum(axis = 0)\n",
    "\n",
    "#     average computed values of the modified 0's from the drug and target\n",
    "#     sides while preserving the 1's that were already in Y \n",
    "    y3 = np.fmax(Y,((y2_new1 + y2_new2)/2))\n",
    "    return y3"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7a4b0524",
   "metadata": {},
   "source": [
    "# returnEvaluationMetrics"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "58954e5f",
   "metadata": {},
   "outputs": [],
   "source": [
    "def returnEvaluationMetrics(Y,scores):\n",
    "# returnEvaluationMetrics computes the AUC and AUPR from a set of prediction\n",
    "# scores and their corresponding labels.\n",
    "# \n",
    "# [AUC,AUPR] = returnEvaluationMetrics(Y,scores)\n",
    "# \n",
    "# INPUT:\n",
    "#  Y:       labels\n",
    "#  scores:  prediction scores\n",
    "# \n",
    "# OUTPUT:\n",
    "#  AUC:     area under ROC curve\n",
    "#  AUPR:    area under precision-recall curve\n",
    "\n",
    "    \n",
    "    AUCi = roc_auc_score(Y, scores)\n",
    "    AUPRi = average_precision_score(Y, scores)\n",
    "    return AUCi, AUPRi"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "bc3cfcd4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Abacavir</th>\n",
       "      <th>Acyclovir</th>\n",
       "      <th>Adefovir</th>\n",
       "      <th>Adefovir dipivoxil</th>\n",
       "      <th>Amantadine</th>\n",
       "      <th>Amprenavir</th>\n",
       "      <th>Asunaprevir</th>\n",
       "      <th>Atazanavir</th>\n",
       "      <th>Baloxavir marboxil</th>\n",
       "      <th>Beclabuvir</th>\n",
       "      <th>...</th>\n",
       "      <th>Valaciclovir</th>\n",
       "      <th>Valganciclovir</th>\n",
       "      <th>Valomaciclovir</th>\n",
       "      <th>Vaniprevir</th>\n",
       "      <th>Velpatasvir</th>\n",
       "      <th>Vidarabine</th>\n",
       "      <th>Voxilaprevir</th>\n",
       "      <th>Zalcitabine</th>\n",
       "      <th>Zanamivir</th>\n",
       "      <th>Zidovudine</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.804857</td>\n",
       "      <td>0.014063</td>\n",
       "      <td>0.014227</td>\n",
       "      <td>0.012874</td>\n",
       "      <td>0.005175</td>\n",
       "      <td>0.005477</td>\n",
       "      <td>0.002829</td>\n",
       "      <td>0.005153</td>\n",
       "      <td>0.002722</td>\n",
       "      <td>0.002752</td>\n",
       "      <td>...</td>\n",
       "      <td>0.009562</td>\n",
       "      <td>0.012644</td>\n",
       "      <td>0.012105</td>\n",
       "      <td>0.002914</td>\n",
       "      <td>0.002876</td>\n",
       "      <td>0.013635</td>\n",
       "      <td>0.002896</td>\n",
       "      <td>0.011846</td>\n",
       "      <td>0.004346</td>\n",
       "      <td>0.010419</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.014063</td>\n",
       "      <td>0.877465</td>\n",
       "      <td>0.014083</td>\n",
       "      <td>0.013013</td>\n",
       "      <td>0.003080</td>\n",
       "      <td>0.003867</td>\n",
       "      <td>0.001724</td>\n",
       "      <td>0.003264</td>\n",
       "      <td>0.001772</td>\n",
       "      <td>0.001677</td>\n",
       "      <td>...</td>\n",
       "      <td>0.012785</td>\n",
       "      <td>0.017923</td>\n",
       "      <td>0.016013</td>\n",
       "      <td>0.001834</td>\n",
       "      <td>0.001761</td>\n",
       "      <td>0.015523</td>\n",
       "      <td>0.001796</td>\n",
       "      <td>0.008669</td>\n",
       "      <td>0.003748</td>\n",
       "      <td>0.007465</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.014227</td>\n",
       "      <td>0.014083</td>\n",
       "      <td>0.809157</td>\n",
       "      <td>0.017310</td>\n",
       "      <td>0.003406</td>\n",
       "      <td>0.005881</td>\n",
       "      <td>0.002859</td>\n",
       "      <td>0.005223</td>\n",
       "      <td>0.002735</td>\n",
       "      <td>0.002775</td>\n",
       "      <td>...</td>\n",
       "      <td>0.009659</td>\n",
       "      <td>0.013665</td>\n",
       "      <td>0.013019</td>\n",
       "      <td>0.002929</td>\n",
       "      <td>0.002920</td>\n",
       "      <td>0.011509</td>\n",
       "      <td>0.002918</td>\n",
       "      <td>0.008683</td>\n",
       "      <td>0.004607</td>\n",
       "      <td>0.007900</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.012874</td>\n",
       "      <td>0.013013</td>\n",
       "      <td>0.017310</td>\n",
       "      <td>0.809594</td>\n",
       "      <td>0.003475</td>\n",
       "      <td>0.006331</td>\n",
       "      <td>0.003707</td>\n",
       "      <td>0.005948</td>\n",
       "      <td>0.002885</td>\n",
       "      <td>0.003143</td>\n",
       "      <td>...</td>\n",
       "      <td>0.009441</td>\n",
       "      <td>0.013194</td>\n",
       "      <td>0.012362</td>\n",
       "      <td>0.003456</td>\n",
       "      <td>0.003383</td>\n",
       "      <td>0.010465</td>\n",
       "      <td>0.003416</td>\n",
       "      <td>0.007881</td>\n",
       "      <td>0.004562</td>\n",
       "      <td>0.007399</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.005175</td>\n",
       "      <td>0.003080</td>\n",
       "      <td>0.003406</td>\n",
       "      <td>0.003475</td>\n",
       "      <td>0.938064</td>\n",
       "      <td>0.004015</td>\n",
       "      <td>0.005334</td>\n",
       "      <td>0.004269</td>\n",
       "      <td>0.003828</td>\n",
       "      <td>0.005386</td>\n",
       "      <td>...</td>\n",
       "      <td>0.002354</td>\n",
       "      <td>0.002820</td>\n",
       "      <td>0.002911</td>\n",
       "      <td>0.006125</td>\n",
       "      <td>0.003796</td>\n",
       "      <td>0.003357</td>\n",
       "      <td>0.005901</td>\n",
       "      <td>0.003968</td>\n",
       "      <td>0.006665</td>\n",
       "      <td>0.003848</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>116</th>\n",
       "      <td>0.013635</td>\n",
       "      <td>0.015523</td>\n",
       "      <td>0.011509</td>\n",
       "      <td>0.010465</td>\n",
       "      <td>0.003357</td>\n",
       "      <td>0.003531</td>\n",
       "      <td>0.001688</td>\n",
       "      <td>0.003239</td>\n",
       "      <td>0.001780</td>\n",
       "      <td>0.001645</td>\n",
       "      <td>...</td>\n",
       "      <td>0.010235</td>\n",
       "      <td>0.012898</td>\n",
       "      <td>0.011290</td>\n",
       "      <td>0.001812</td>\n",
       "      <td>0.001714</td>\n",
       "      <td>0.868632</td>\n",
       "      <td>0.001765</td>\n",
       "      <td>0.011428</td>\n",
       "      <td>0.005282</td>\n",
       "      <td>0.010762</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>117</th>\n",
       "      <td>0.002896</td>\n",
       "      <td>0.001796</td>\n",
       "      <td>0.002918</td>\n",
       "      <td>0.003416</td>\n",
       "      <td>0.005901</td>\n",
       "      <td>0.005999</td>\n",
       "      <td>0.018994</td>\n",
       "      <td>0.008594</td>\n",
       "      <td>0.005656</td>\n",
       "      <td>0.016828</td>\n",
       "      <td>...</td>\n",
       "      <td>0.001487</td>\n",
       "      <td>0.001785</td>\n",
       "      <td>0.001789</td>\n",
       "      <td>0.019930</td>\n",
       "      <td>0.011066</td>\n",
       "      <td>0.001765</td>\n",
       "      <td>0.875760</td>\n",
       "      <td>0.002894</td>\n",
       "      <td>0.002943</td>\n",
       "      <td>0.002844</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>118</th>\n",
       "      <td>0.011846</td>\n",
       "      <td>0.008669</td>\n",
       "      <td>0.008683</td>\n",
       "      <td>0.007881</td>\n",
       "      <td>0.003968</td>\n",
       "      <td>0.005388</td>\n",
       "      <td>0.002816</td>\n",
       "      <td>0.005120</td>\n",
       "      <td>0.002777</td>\n",
       "      <td>0.002747</td>\n",
       "      <td>...</td>\n",
       "      <td>0.005596</td>\n",
       "      <td>0.006840</td>\n",
       "      <td>0.006265</td>\n",
       "      <td>0.002932</td>\n",
       "      <td>0.002857</td>\n",
       "      <td>0.011428</td>\n",
       "      <td>0.002894</td>\n",
       "      <td>0.801694</td>\n",
       "      <td>0.004904</td>\n",
       "      <td>0.016712</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>119</th>\n",
       "      <td>0.004346</td>\n",
       "      <td>0.003748</td>\n",
       "      <td>0.004607</td>\n",
       "      <td>0.004562</td>\n",
       "      <td>0.006665</td>\n",
       "      <td>0.003629</td>\n",
       "      <td>0.002856</td>\n",
       "      <td>0.003592</td>\n",
       "      <td>0.003562</td>\n",
       "      <td>0.002715</td>\n",
       "      <td>...</td>\n",
       "      <td>0.002705</td>\n",
       "      <td>0.003547</td>\n",
       "      <td>0.004130</td>\n",
       "      <td>0.003200</td>\n",
       "      <td>0.002585</td>\n",
       "      <td>0.005282</td>\n",
       "      <td>0.002943</td>\n",
       "      <td>0.004904</td>\n",
       "      <td>0.922754</td>\n",
       "      <td>0.005071</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>120</th>\n",
       "      <td>0.010419</td>\n",
       "      <td>0.007465</td>\n",
       "      <td>0.007900</td>\n",
       "      <td>0.007399</td>\n",
       "      <td>0.003848</td>\n",
       "      <td>0.005419</td>\n",
       "      <td>0.002764</td>\n",
       "      <td>0.005067</td>\n",
       "      <td>0.002851</td>\n",
       "      <td>0.002705</td>\n",
       "      <td>...</td>\n",
       "      <td>0.005091</td>\n",
       "      <td>0.006233</td>\n",
       "      <td>0.005949</td>\n",
       "      <td>0.002883</td>\n",
       "      <td>0.002811</td>\n",
       "      <td>0.010762</td>\n",
       "      <td>0.002844</td>\n",
       "      <td>0.016712</td>\n",
       "      <td>0.005071</td>\n",
       "      <td>0.802659</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>121 rows × 121 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     Abacavir  Acyclovir  Adefovir  Adefovir dipivoxil  Amantadine  \\\n",
       "0    0.804857   0.014063  0.014227            0.012874    0.005175   \n",
       "1    0.014063   0.877465  0.014083            0.013013    0.003080   \n",
       "2    0.014227   0.014083  0.809157            0.017310    0.003406   \n",
       "3    0.012874   0.013013  0.017310            0.809594    0.003475   \n",
       "4    0.005175   0.003080  0.003406            0.003475    0.938064   \n",
       "..        ...        ...       ...                 ...         ...   \n",
       "116  0.013635   0.015523  0.011509            0.010465    0.003357   \n",
       "117  0.002896   0.001796  0.002918            0.003416    0.005901   \n",
       "118  0.011846   0.008669  0.008683            0.007881    0.003968   \n",
       "119  0.004346   0.003748  0.004607            0.004562    0.006665   \n",
       "120  0.010419   0.007465  0.007900            0.007399    0.003848   \n",
       "\n",
       "     Amprenavir  Asunaprevir  Atazanavir  Baloxavir marboxil  Beclabuvir  ...  \\\n",
       "0      0.005477     0.002829    0.005153            0.002722    0.002752  ...   \n",
       "1      0.003867     0.001724    0.003264            0.001772    0.001677  ...   \n",
       "2      0.005881     0.002859    0.005223            0.002735    0.002775  ...   \n",
       "3      0.006331     0.003707    0.005948            0.002885    0.003143  ...   \n",
       "4      0.004015     0.005334    0.004269            0.003828    0.005386  ...   \n",
       "..          ...          ...         ...                 ...         ...  ...   \n",
       "116    0.003531     0.001688    0.003239            0.001780    0.001645  ...   \n",
       "117    0.005999     0.018994    0.008594            0.005656    0.016828  ...   \n",
       "118    0.005388     0.002816    0.005120            0.002777    0.002747  ...   \n",
       "119    0.003629     0.002856    0.003592            0.003562    0.002715  ...   \n",
       "120    0.005419     0.002764    0.005067            0.002851    0.002705  ...   \n",
       "\n",
       "     Valaciclovir  Valganciclovir  Valomaciclovir  Vaniprevir  Velpatasvir  \\\n",
       "0        0.009562        0.012644        0.012105    0.002914     0.002876   \n",
       "1        0.012785        0.017923        0.016013    0.001834     0.001761   \n",
       "2        0.009659        0.013665        0.013019    0.002929     0.002920   \n",
       "3        0.009441        0.013194        0.012362    0.003456     0.003383   \n",
       "4        0.002354        0.002820        0.002911    0.006125     0.003796   \n",
       "..            ...             ...             ...         ...          ...   \n",
       "116      0.010235        0.012898        0.011290    0.001812     0.001714   \n",
       "117      0.001487        0.001785        0.001789    0.019930     0.011066   \n",
       "118      0.005596        0.006840        0.006265    0.002932     0.002857   \n",
       "119      0.002705        0.003547        0.004130    0.003200     0.002585   \n",
       "120      0.005091        0.006233        0.005949    0.002883     0.002811   \n",
       "\n",
       "     Vidarabine  Voxilaprevir  Zalcitabine  Zanamivir  Zidovudine  \n",
       "0      0.013635      0.002896     0.011846   0.004346    0.010419  \n",
       "1      0.015523      0.001796     0.008669   0.003748    0.007465  \n",
       "2      0.011509      0.002918     0.008683   0.004607    0.007900  \n",
       "3      0.010465      0.003416     0.007881   0.004562    0.007399  \n",
       "4      0.003357      0.005901     0.003968   0.006665    0.003848  \n",
       "..          ...           ...          ...        ...         ...  \n",
       "116    0.868632      0.001765     0.011428   0.005282    0.010762  \n",
       "117    0.001765      0.875760     0.002894   0.002943    0.002844  \n",
       "118    0.011428      0.002894     0.801694   0.004904    0.016712  \n",
       "119    0.005282      0.002943     0.004904   0.922754    0.005071  \n",
       "120    0.010762      0.002844     0.016712   0.005071    0.802659  \n",
       "\n",
       "[121 rows x 121 columns]"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fused_sim_df = pd.read_csv('fused_sim_drug.csv')\n",
    "fused_sim_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "ddfe322d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Abacavir</th>\n",
       "      <th>Acyclovir</th>\n",
       "      <th>Adefovir</th>\n",
       "      <th>Adefovir dipivoxil</th>\n",
       "      <th>Amantadine</th>\n",
       "      <th>Amprenavir</th>\n",
       "      <th>Asunaprevir</th>\n",
       "      <th>Atazanavir</th>\n",
       "      <th>Baloxavir marboxil</th>\n",
       "      <th>Beclabuvir</th>\n",
       "      <th>...</th>\n",
       "      <th>Valaciclovir</th>\n",
       "      <th>Valganciclovir</th>\n",
       "      <th>Valomaciclovir</th>\n",
       "      <th>Vaniprevir</th>\n",
       "      <th>Velpatasvir</th>\n",
       "      <th>Vidarabine</th>\n",
       "      <th>Voxilaprevir</th>\n",
       "      <th>Zalcitabine</th>\n",
       "      <th>Zanamivir</th>\n",
       "      <th>Zidovudine</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.729566</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.302989</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.323866</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.240832</td>\n",
       "      <td>0.275594</td>\n",
       "      <td>...</td>\n",
       "      <td>0.325967</td>\n",
       "      <td>0.586864</td>\n",
       "      <td>0.498892</td>\n",
       "      <td>0.292723</td>\n",
       "      <td>0.335166</td>\n",
       "      <td>0.735413</td>\n",
       "      <td>0.301045</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.329941</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.729566</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.787659</td>\n",
       "      <td>0.702240</td>\n",
       "      <td>0.025974</td>\n",
       "      <td>0.169811</td>\n",
       "      <td>0.138079</td>\n",
       "      <td>0.181077</td>\n",
       "      <td>0.215095</td>\n",
       "      <td>0.142480</td>\n",
       "      <td>...</td>\n",
       "      <td>0.694215</td>\n",
       "      <td>0.754732</td>\n",
       "      <td>0.600619</td>\n",
       "      <td>0.088825</td>\n",
       "      <td>0.202638</td>\n",
       "      <td>0.765523</td>\n",
       "      <td>0.170885</td>\n",
       "      <td>0.563909</td>\n",
       "      <td>0.198566</td>\n",
       "      <td>0.417816</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.787659</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.024390</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.157983</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.201850</td>\n",
       "      <td>0.160329</td>\n",
       "      <td>...</td>\n",
       "      <td>0.423841</td>\n",
       "      <td>0.570919</td>\n",
       "      <td>0.526331</td>\n",
       "      <td>0.096547</td>\n",
       "      <td>0.199215</td>\n",
       "      <td>0.781387</td>\n",
       "      <td>0.156955</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.127273</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.702240</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.016129</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.320649</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.260127</td>\n",
       "      <td>0.227101</td>\n",
       "      <td>...</td>\n",
       "      <td>0.423841</td>\n",
       "      <td>0.555263</td>\n",
       "      <td>0.505114</td>\n",
       "      <td>0.207370</td>\n",
       "      <td>0.275981</td>\n",
       "      <td>0.692724</td>\n",
       "      <td>0.258941</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.144737</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.302989</td>\n",
       "      <td>0.025974</td>\n",
       "      <td>0.024390</td>\n",
       "      <td>0.016129</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.133758</td>\n",
       "      <td>0.241249</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.098294</td>\n",
       "      <td>0.234445</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.020000</td>\n",
       "      <td>0.020000</td>\n",
       "      <td>0.215385</td>\n",
       "      <td>0.170565</td>\n",
       "      <td>0.094118</td>\n",
       "      <td>0.203017</td>\n",
       "      <td>0.223924</td>\n",
       "      <td>0.086957</td>\n",
       "      <td>0.226919</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>116</th>\n",
       "      <td>0.735413</td>\n",
       "      <td>0.765523</td>\n",
       "      <td>0.781387</td>\n",
       "      <td>0.692724</td>\n",
       "      <td>0.094118</td>\n",
       "      <td>0.189030</td>\n",
       "      <td>0.174854</td>\n",
       "      <td>0.143710</td>\n",
       "      <td>0.176550</td>\n",
       "      <td>0.218584</td>\n",
       "      <td>...</td>\n",
       "      <td>0.465798</td>\n",
       "      <td>0.659171</td>\n",
       "      <td>0.478094</td>\n",
       "      <td>0.177627</td>\n",
       "      <td>0.216846</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.225104</td>\n",
       "      <td>0.693481</td>\n",
       "      <td>0.308832</td>\n",
       "      <td>0.597065</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>117</th>\n",
       "      <td>0.301045</td>\n",
       "      <td>0.170885</td>\n",
       "      <td>0.156955</td>\n",
       "      <td>0.258941</td>\n",
       "      <td>0.203017</td>\n",
       "      <td>0.372564</td>\n",
       "      <td>0.716186</td>\n",
       "      <td>0.472201</td>\n",
       "      <td>0.405286</td>\n",
       "      <td>0.597307</td>\n",
       "      <td>...</td>\n",
       "      <td>0.057579</td>\n",
       "      <td>0.252019</td>\n",
       "      <td>0.271509</td>\n",
       "      <td>0.796336</td>\n",
       "      <td>0.472012</td>\n",
       "      <td>0.225104</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.254785</td>\n",
       "      <td>0.258111</td>\n",
       "      <td>0.261145</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>118</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.563909</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.223924</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.234293</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.308991</td>\n",
       "      <td>0.256885</td>\n",
       "      <td>...</td>\n",
       "      <td>0.273885</td>\n",
       "      <td>0.484485</td>\n",
       "      <td>0.329011</td>\n",
       "      <td>0.267934</td>\n",
       "      <td>0.241896</td>\n",
       "      <td>0.693481</td>\n",
       "      <td>0.254785</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.300938</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>119</th>\n",
       "      <td>0.329941</td>\n",
       "      <td>0.198566</td>\n",
       "      <td>0.127273</td>\n",
       "      <td>0.144737</td>\n",
       "      <td>0.086957</td>\n",
       "      <td>0.334191</td>\n",
       "      <td>0.248917</td>\n",
       "      <td>0.260578</td>\n",
       "      <td>0.126437</td>\n",
       "      <td>0.167367</td>\n",
       "      <td>...</td>\n",
       "      <td>0.121718</td>\n",
       "      <td>0.299691</td>\n",
       "      <td>0.342526</td>\n",
       "      <td>0.264230</td>\n",
       "      <td>0.232959</td>\n",
       "      <td>0.308832</td>\n",
       "      <td>0.258111</td>\n",
       "      <td>0.300938</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.327128</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>120</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.417816</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.226919</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.241986</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.289198</td>\n",
       "      <td>0.239673</td>\n",
       "      <td>...</td>\n",
       "      <td>0.151832</td>\n",
       "      <td>0.474576</td>\n",
       "      <td>0.376799</td>\n",
       "      <td>0.236587</td>\n",
       "      <td>0.226286</td>\n",
       "      <td>0.597065</td>\n",
       "      <td>0.261145</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.327128</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>121 rows × 121 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     Abacavir  Acyclovir  Adefovir  Adefovir dipivoxil  Amantadine  \\\n",
       "0    1.000000   0.729566  1.000000            1.000000    0.302989   \n",
       "1    0.729566   1.000000  0.787659            0.702240    0.025974   \n",
       "2    1.000000   0.787659  1.000000            1.000000    0.024390   \n",
       "3    1.000000   0.702240  1.000000            1.000000    0.016129   \n",
       "4    0.302989   0.025974  0.024390            0.016129    1.000000   \n",
       "..        ...        ...       ...                 ...         ...   \n",
       "116  0.735413   0.765523  0.781387            0.692724    0.094118   \n",
       "117  0.301045   0.170885  0.156955            0.258941    0.203017   \n",
       "118  1.000000   0.563909  1.000000            1.000000    0.223924   \n",
       "119  0.329941   0.198566  0.127273            0.144737    0.086957   \n",
       "120  1.000000   0.417816  1.000000            1.000000    0.226919   \n",
       "\n",
       "     Amprenavir  Asunaprevir  Atazanavir  Baloxavir marboxil  Beclabuvir  ...  \\\n",
       "0      1.000000     0.323866    1.000000            0.240832    0.275594  ...   \n",
       "1      0.169811     0.138079    0.181077            0.215095    0.142480  ...   \n",
       "2      1.000000     0.157983    1.000000            0.201850    0.160329  ...   \n",
       "3      1.000000     0.320649    1.000000            0.260127    0.227101  ...   \n",
       "4      0.133758     0.241249    0.000000            0.098294    0.234445  ...   \n",
       "..          ...          ...         ...                 ...         ...  ...   \n",
       "116    0.189030     0.174854    0.143710            0.176550    0.218584  ...   \n",
       "117    0.372564     0.716186    0.472201            0.405286    0.597307  ...   \n",
       "118    1.000000     0.234293    1.000000            0.308991    0.256885  ...   \n",
       "119    0.334191     0.248917    0.260578            0.126437    0.167367  ...   \n",
       "120    1.000000     0.241986    1.000000            0.289198    0.239673  ...   \n",
       "\n",
       "     Valaciclovir  Valganciclovir  Valomaciclovir  Vaniprevir  Velpatasvir  \\\n",
       "0        0.325967        0.586864        0.498892    0.292723     0.335166   \n",
       "1        0.694215        0.754732        0.600619    0.088825     0.202638   \n",
       "2        0.423841        0.570919        0.526331    0.096547     0.199215   \n",
       "3        0.423841        0.555263        0.505114    0.207370     0.275981   \n",
       "4        0.000000        0.020000        0.020000    0.215385     0.170565   \n",
       "..            ...             ...             ...         ...          ...   \n",
       "116      0.465798        0.659171        0.478094    0.177627     0.216846   \n",
       "117      0.057579        0.252019        0.271509    0.796336     0.472012   \n",
       "118      0.273885        0.484485        0.329011    0.267934     0.241896   \n",
       "119      0.121718        0.299691        0.342526    0.264230     0.232959   \n",
       "120      0.151832        0.474576        0.376799    0.236587     0.226286   \n",
       "\n",
       "     Vidarabine  Voxilaprevir  Zalcitabine  Zanamivir  Zidovudine  \n",
       "0      0.735413      0.301045     1.000000   0.329941    1.000000  \n",
       "1      0.765523      0.170885     0.563909   0.198566    0.417816  \n",
       "2      0.781387      0.156955     1.000000   0.127273    1.000000  \n",
       "3      0.692724      0.258941     1.000000   0.144737    1.000000  \n",
       "4      0.094118      0.203017     0.223924   0.086957    0.226919  \n",
       "..          ...           ...          ...        ...         ...  \n",
       "116    1.000000      0.225104     0.693481   0.308832    0.597065  \n",
       "117    0.225104      1.000000     0.254785   0.258111    0.261145  \n",
       "118    0.693481      0.254785     1.000000   0.300938    1.000000  \n",
       "119    0.308832      0.258111     0.300938   1.000000    0.327128  \n",
       "120    0.597065      0.261145     1.000000   0.327128    1.000000  \n",
       "\n",
       "[121 rows x 121 columns]"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fused_sim_df1 = pd.read_csv('fused_sim_drug1.csv')\n",
    "fused_sim_df1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "dd8ba258",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Abacavir</th>\n",
       "      <th>Acyclovir</th>\n",
       "      <th>Adefovir</th>\n",
       "      <th>Adefovir dipivoxil</th>\n",
       "      <th>Amantadine</th>\n",
       "      <th>Amprenavir</th>\n",
       "      <th>Asunaprevir</th>\n",
       "      <th>Atazanavir</th>\n",
       "      <th>Baloxavir marboxil</th>\n",
       "      <th>Beclabuvir</th>\n",
       "      <th>...</th>\n",
       "      <th>Valaciclovir</th>\n",
       "      <th>Valganciclovir</th>\n",
       "      <th>Valomaciclovir</th>\n",
       "      <th>Vaniprevir</th>\n",
       "      <th>Velpatasvir</th>\n",
       "      <th>Vidarabine</th>\n",
       "      <th>Voxilaprevir</th>\n",
       "      <th>Zalcitabine</th>\n",
       "      <th>Zanamivir</th>\n",
       "      <th>Zidovudine</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.736385</td>\n",
       "      <td>0.609824</td>\n",
       "      <td>0.551532</td>\n",
       "      <td>0.319238</td>\n",
       "      <td>0.259851</td>\n",
       "      <td>0.323866</td>\n",
       "      <td>0.215288</td>\n",
       "      <td>0.240832</td>\n",
       "      <td>0.275594</td>\n",
       "      <td>...</td>\n",
       "      <td>0.325967</td>\n",
       "      <td>0.593647</td>\n",
       "      <td>0.498892</td>\n",
       "      <td>0.306149</td>\n",
       "      <td>0.344066</td>\n",
       "      <td>0.738955</td>\n",
       "      <td>0.312520</td>\n",
       "      <td>0.634924</td>\n",
       "      <td>0.336275</td>\n",
       "      <td>0.477348</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.736385</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.789181</td>\n",
       "      <td>0.705263</td>\n",
       "      <td>0.043198</td>\n",
       "      <td>0.183194</td>\n",
       "      <td>0.138079</td>\n",
       "      <td>0.200820</td>\n",
       "      <td>0.215095</td>\n",
       "      <td>0.142480</td>\n",
       "      <td>...</td>\n",
       "      <td>0.694215</td>\n",
       "      <td>0.805927</td>\n",
       "      <td>0.600619</td>\n",
       "      <td>0.101944</td>\n",
       "      <td>0.210734</td>\n",
       "      <td>0.767904</td>\n",
       "      <td>0.181210</td>\n",
       "      <td>0.570939</td>\n",
       "      <td>0.204313</td>\n",
       "      <td>0.434222</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.609824</td>\n",
       "      <td>0.789181</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.030858</td>\n",
       "      <td>0.223781</td>\n",
       "      <td>0.157983</td>\n",
       "      <td>0.193629</td>\n",
       "      <td>0.201850</td>\n",
       "      <td>0.160329</td>\n",
       "      <td>...</td>\n",
       "      <td>0.423841</td>\n",
       "      <td>0.572922</td>\n",
       "      <td>0.526331</td>\n",
       "      <td>0.101424</td>\n",
       "      <td>0.202264</td>\n",
       "      <td>0.782220</td>\n",
       "      <td>0.160891</td>\n",
       "      <td>0.422775</td>\n",
       "      <td>0.129619</td>\n",
       "      <td>0.312283</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.551532</td>\n",
       "      <td>0.705263</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.025366</td>\n",
       "      <td>0.238705</td>\n",
       "      <td>0.320649</td>\n",
       "      <td>0.334093</td>\n",
       "      <td>0.260127</td>\n",
       "      <td>0.227101</td>\n",
       "      <td>...</td>\n",
       "      <td>0.423841</td>\n",
       "      <td>0.558203</td>\n",
       "      <td>0.505114</td>\n",
       "      <td>0.213429</td>\n",
       "      <td>0.279884</td>\n",
       "      <td>0.694380</td>\n",
       "      <td>0.263840</td>\n",
       "      <td>0.356224</td>\n",
       "      <td>0.147993</td>\n",
       "      <td>0.291086</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.319238</td>\n",
       "      <td>0.043198</td>\n",
       "      <td>0.030858</td>\n",
       "      <td>0.025366</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.146668</td>\n",
       "      <td>0.241249</td>\n",
       "      <td>0.022289</td>\n",
       "      <td>0.098294</td>\n",
       "      <td>0.234445</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.031283</td>\n",
       "      <td>0.020000</td>\n",
       "      <td>0.225830</td>\n",
       "      <td>0.178352</td>\n",
       "      <td>0.102622</td>\n",
       "      <td>0.212193</td>\n",
       "      <td>0.235491</td>\n",
       "      <td>0.093009</td>\n",
       "      <td>0.257200</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>116</th>\n",
       "      <td>0.738955</td>\n",
       "      <td>0.767904</td>\n",
       "      <td>0.782220</td>\n",
       "      <td>0.694380</td>\n",
       "      <td>0.102622</td>\n",
       "      <td>0.195971</td>\n",
       "      <td>0.174854</td>\n",
       "      <td>0.154670</td>\n",
       "      <td>0.176550</td>\n",
       "      <td>0.218584</td>\n",
       "      <td>...</td>\n",
       "      <td>0.465798</td>\n",
       "      <td>0.661425</td>\n",
       "      <td>0.478094</td>\n",
       "      <td>0.183913</td>\n",
       "      <td>0.221068</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.230227</td>\n",
       "      <td>0.696104</td>\n",
       "      <td>0.311463</td>\n",
       "      <td>0.606128</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>117</th>\n",
       "      <td>0.312520</td>\n",
       "      <td>0.181210</td>\n",
       "      <td>0.160891</td>\n",
       "      <td>0.263840</td>\n",
       "      <td>0.212193</td>\n",
       "      <td>0.379150</td>\n",
       "      <td>0.716186</td>\n",
       "      <td>0.480485</td>\n",
       "      <td>0.405286</td>\n",
       "      <td>0.597307</td>\n",
       "      <td>...</td>\n",
       "      <td>0.057579</td>\n",
       "      <td>0.258083</td>\n",
       "      <td>0.271509</td>\n",
       "      <td>0.798246</td>\n",
       "      <td>0.902531</td>\n",
       "      <td>0.230227</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.262606</td>\n",
       "      <td>0.261575</td>\n",
       "      <td>0.281526</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>118</th>\n",
       "      <td>0.634924</td>\n",
       "      <td>0.570939</td>\n",
       "      <td>0.422775</td>\n",
       "      <td>0.356224</td>\n",
       "      <td>0.235491</td>\n",
       "      <td>0.335203</td>\n",
       "      <td>0.234293</td>\n",
       "      <td>0.170097</td>\n",
       "      <td>0.308991</td>\n",
       "      <td>0.256885</td>\n",
       "      <td>...</td>\n",
       "      <td>0.273885</td>\n",
       "      <td>0.489896</td>\n",
       "      <td>0.329011</td>\n",
       "      <td>0.276819</td>\n",
       "      <td>0.248384</td>\n",
       "      <td>0.696104</td>\n",
       "      <td>0.262606</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.305163</td>\n",
       "      <td>0.811619</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>119</th>\n",
       "      <td>0.336275</td>\n",
       "      <td>0.204313</td>\n",
       "      <td>0.129619</td>\n",
       "      <td>0.147993</td>\n",
       "      <td>0.093009</td>\n",
       "      <td>0.338215</td>\n",
       "      <td>0.248917</td>\n",
       "      <td>0.267261</td>\n",
       "      <td>0.126437</td>\n",
       "      <td>0.167367</td>\n",
       "      <td>...</td>\n",
       "      <td>0.121718</td>\n",
       "      <td>0.302960</td>\n",
       "      <td>0.342526</td>\n",
       "      <td>0.268202</td>\n",
       "      <td>0.235879</td>\n",
       "      <td>0.311463</td>\n",
       "      <td>0.261575</td>\n",
       "      <td>0.305163</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.337815</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>120</th>\n",
       "      <td>0.477348</td>\n",
       "      <td>0.434222</td>\n",
       "      <td>0.312283</td>\n",
       "      <td>0.291086</td>\n",
       "      <td>0.257200</td>\n",
       "      <td>0.297576</td>\n",
       "      <td>0.241986</td>\n",
       "      <td>0.253053</td>\n",
       "      <td>0.289198</td>\n",
       "      <td>0.239673</td>\n",
       "      <td>...</td>\n",
       "      <td>0.151832</td>\n",
       "      <td>0.572708</td>\n",
       "      <td>0.376799</td>\n",
       "      <td>0.425099</td>\n",
       "      <td>0.243688</td>\n",
       "      <td>0.606128</td>\n",
       "      <td>0.281526</td>\n",
       "      <td>0.811619</td>\n",
       "      <td>0.337815</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>121 rows × 121 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     Abacavir  Acyclovir  Adefovir  Adefovir dipivoxil  Amantadine  \\\n",
       "0    1.000000   0.736385  0.609824            0.551532    0.319238   \n",
       "1    0.736385   1.000000  0.789181            0.705263    0.043198   \n",
       "2    0.609824   0.789181  1.000000            1.000000    0.030858   \n",
       "3    0.551532   0.705263  1.000000            1.000000    0.025366   \n",
       "4    0.319238   0.043198  0.030858            0.025366    1.000000   \n",
       "..        ...        ...       ...                 ...         ...   \n",
       "116  0.738955   0.767904  0.782220            0.694380    0.102622   \n",
       "117  0.312520   0.181210  0.160891            0.263840    0.212193   \n",
       "118  0.634924   0.570939  0.422775            0.356224    0.235491   \n",
       "119  0.336275   0.204313  0.129619            0.147993    0.093009   \n",
       "120  0.477348   0.434222  0.312283            0.291086    0.257200   \n",
       "\n",
       "     Amprenavir  Asunaprevir  Atazanavir  Baloxavir marboxil  Beclabuvir  ...  \\\n",
       "0      0.259851     0.323866    0.215288            0.240832    0.275594  ...   \n",
       "1      0.183194     0.138079    0.200820            0.215095    0.142480  ...   \n",
       "2      0.223781     0.157983    0.193629            0.201850    0.160329  ...   \n",
       "3      0.238705     0.320649    0.334093            0.260127    0.227101  ...   \n",
       "4      0.146668     0.241249    0.022289            0.098294    0.234445  ...   \n",
       "..          ...          ...         ...                 ...         ...  ...   \n",
       "116    0.195971     0.174854    0.154670            0.176550    0.218584  ...   \n",
       "117    0.379150     0.716186    0.480485            0.405286    0.597307  ...   \n",
       "118    0.335203     0.234293    0.170097            0.308991    0.256885  ...   \n",
       "119    0.338215     0.248917    0.267261            0.126437    0.167367  ...   \n",
       "120    0.297576     0.241986    0.253053            0.289198    0.239673  ...   \n",
       "\n",
       "     Valaciclovir  Valganciclovir  Valomaciclovir  Vaniprevir  Velpatasvir  \\\n",
       "0        0.325967        0.593647        0.498892    0.306149     0.344066   \n",
       "1        0.694215        0.805927        0.600619    0.101944     0.210734   \n",
       "2        0.423841        0.572922        0.526331    0.101424     0.202264   \n",
       "3        0.423841        0.558203        0.505114    0.213429     0.279884   \n",
       "4        0.000000        0.031283        0.020000    0.225830     0.178352   \n",
       "..            ...             ...             ...         ...          ...   \n",
       "116      0.465798        0.661425        0.478094    0.183913     0.221068   \n",
       "117      0.057579        0.258083        0.271509    0.798246     0.902531   \n",
       "118      0.273885        0.489896        0.329011    0.276819     0.248384   \n",
       "119      0.121718        0.302960        0.342526    0.268202     0.235879   \n",
       "120      0.151832        0.572708        0.376799    0.425099     0.243688   \n",
       "\n",
       "     Vidarabine  Voxilaprevir  Zalcitabine  Zanamivir  Zidovudine  \n",
       "0      0.738955      0.312520     0.634924   0.336275    0.477348  \n",
       "1      0.767904      0.181210     0.570939   0.204313    0.434222  \n",
       "2      0.782220      0.160891     0.422775   0.129619    0.312283  \n",
       "3      0.694380      0.263840     0.356224   0.147993    0.291086  \n",
       "4      0.102622      0.212193     0.235491   0.093009    0.257200  \n",
       "..          ...           ...          ...        ...         ...  \n",
       "116    1.000000      0.230227     0.696104   0.311463    0.606128  \n",
       "117    0.230227      1.000000     0.262606   0.261575    0.281526  \n",
       "118    0.696104      0.262606     1.000000   0.305163    0.811619  \n",
       "119    0.311463      0.261575     0.305163   1.000000    0.337815  \n",
       "120    0.606128      0.281526     0.811619   0.337815    1.000000  \n",
       "\n",
       "[121 rows x 121 columns]"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fused_sim_df2 = pd.read_csv('fused_sim_drug2.csv')\n",
    "fused_sim_df2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "e43d82c0",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "m = \n",
      " 1\n",
      "n = \n",
      " 10\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\n",
      "      AUC: %g\n",
      " 0.7982514067603962\n",
      "     AUPR: %g\n",
      " 0.3317657048413457\n",
      "      AUC: %g\n",
      " 0.03429563999492205\n",
      "     AUPR: %g\n",
      " 0.11538410707404435\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n"
     ]
    }
   ],
   "source": [
    "crossval(DVA_drug_virus_interaction_df.values.T, fused_sim_df2.values, DVA_virus_virus_sim_df.values, 'WGRMF', 'cv_p',1,10,True,5, 0.7,True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "43e5db20",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "m = \n",
      " 1\n",
      "n = \n",
      " 10\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\n",
      "      AUC: %g\n",
      " 0.8077350255644319\n",
      "     AUPR: %g\n",
      " 0.5092637942567595\n",
      "      AUC: %g\n",
      " 0.074955609628317\n",
      "     AUPR: %g\n",
      " 0.12254347339005102\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n"
     ]
    }
   ],
   "source": [
    "crossval(DVA_drug_virus_interaction_df.values.T, fused_sim_df2.values, DVA_virus_virus_sim_df.values, 'WGRMF', 'cv_d',1,10,True,5, 0.7,True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "f66f713a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "m = \n",
      " 1\n",
      "n = \n",
      " 10\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\n",
      "      AUC: %g\n",
      " 0.8965168604698224\n",
      "     AUPR: %g\n",
      " 0.669141181264681\n",
      "      AUC: %g\n",
      " 0.09615742383818054\n",
      "     AUPR: %g\n",
      " 0.20934125146923613\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n"
     ]
    }
   ],
   "source": [
    "crossval(DVA_drug_virus_interaction_df.values.T, fused_sim_df2.values, DVA_virus_virus_sim_df.values, 'WGRMF', 'cv_v',1,10,True,5, 0.7,True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "af1f50a5",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "m = \n",
      " 1\n",
      "n = \n",
      " 10\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\n",
      "      AUC: %g\n",
      " 0.8376854039678552\n",
      "     AUPR: %g\n",
      " 0.5502536357719955\n",
      "      AUC: %g\n",
      " 0.12557381910095844\n",
      "     AUPR: %g\n",
      " 0.24962125161652673\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n"
     ]
    }
   ],
   "source": [
    "crossval(DVA_drug_virus_interaction_df.values.T, DVA_drug_drug_sim_df.values, DVA_virus_virus_sim_df.values, 'WGRMF', 'cv_v',1,10,True,5, 0.7,True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "6ddb9f54",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "m = \n",
      " 1\n",
      "n = \n",
      " 10\n",
      "\n",
      "\n",
      "      AUC: %g\n",
      " 0.756472082645995\n",
      "     AUPR: %g\n",
      " 0.40287569466573664\n",
      "      AUC: %g\n",
      " 0.08345282617592469\n",
      "     AUPR: %g\n",
      " 0.0866660509638335\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n"
     ]
    }
   ],
   "source": [
    "crossval(DVA_drug_virus_interaction_df.values.T, DVA_drug_drug_sim_df.values, DVA_virus_virus_sim_df.values, 'WGRMF', 'cv_d',1,10,True,5, 0.7,True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "fd0034bf",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "m = \n",
      " 1\n",
      "n = \n",
      " 10\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\n",
      "      AUC: %g\n",
      " 0.7774118562042356\n",
      "     AUPR: %g\n",
      " 0.32631629577970545\n",
      "      AUC: %g\n",
      " 0.03987692623188993\n",
      "     AUPR: %g\n",
      " 0.11847852511147479\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n",
      "C:\\Users\\k1896702\\AppData\\Local\\Temp\\ipykernel_10100\\4241090288.py:44: RuntimeWarning: invalid value encountered in true_divide\n",
      "  y2_new1[i,:] = np.matmul((eta * drug_sim[indx]), Y[indx,:]) / drug_sim[indx].sum(axis = 0)\n"
     ]
    }
   ],
   "source": [
    "crossval(DVA_drug_virus_interaction_df.values.T, DVA_drug_drug_sim_df.values, DVA_virus_virus_sim_df.values, 'WGRMF', 'cv_p',1,10,True,5, 0.7,True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8d0c3ee1",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  },
  "latex_envs": {
   "LaTeX_envs_menu_present": true,
   "autoclose": false,
   "autocomplete": true,
   "bibliofile": "biblio.bib",
   "cite_by": "apalike",
   "current_citInitial": 1,
   "eqLabelWithNumbers": true,
   "eqNumInitial": 1,
   "hotkeys": {
    "equation": "Ctrl-E",
    "itemize": "Ctrl-I"
   },
   "labels_anchors": false,
   "latex_user_defs": false,
   "report_style_numbering": false,
   "user_envs_cfg": false
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "384px"
   },
   "toc_section_display": true,
   "toc_window_display": false
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
